Focal Point
[SOLVED] Percentage and IF statement

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/439104514

April 09, 2010, 10:30 AM
Latigresa
[SOLVED] Percentage and IF statement
I need to show a percentage IF the county is greater then zero. I tried this code but it comes back "RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD".

code
  
PCT_HO_POL/D3%=HO_REMN_POL_LMT / HO_POL_LMT;

PCT_HO_POL1/A6V=IF AGT_CTY_CD GT '0' AND HO_POL_LMT1 EQ '000000' AND HO_REMN_POL_LMT1 EQ '000000' THEN ' ' ELSE PCT_HO_POL ;


All help is greatly appriciated!!!
Thank you in advance.

This message has been edited. Last edited by: Kerry,


WEBFOCUS 7.6.4
Server: WINXP
April 09, 2010, 10:46 AM
njsden
You cannot assign a numeric field to an alpha field that way.

Do a search on PTOA and/or FTOA function which allows you to convert numbers to alphanumeric values.

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
April 09, 2010, 10:50 AM
Latigresa
quote:
FTOA

I will do research on these Thank You. But the user does want the % sign on the report. Frowner


WEBFOCUS 7.6.4
Server: WINXP
April 09, 2010, 10:55 AM
njsden
You'll find out that FTOA allows you to use "any" valid numeric format and assign it to a alpha field. No worries, it'll work!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
April 09, 2010, 10:58 AM
susannah
quote:
PCT_HO_POL1/A6V=IF AGT_CTY_CD GT '0' AND HO_POL_LMT1 EQ '000000' AND HO_REMN_POL_LMT1 EQ '000000' THEN ' ' ELSE PCT_HO_POL ;


what about
PCT_HO_POL1/D3% MISSING ON =IF AGT_CTY_CD GT '0' AND HO_POL_LMT1 EQ '000000' AND HO_REMN_POL_LMT1 EQ '000000' THEN MISSING ELSE PCT_HO_POL ;




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
April 09, 2010, 10:59 AM
njsden
You can also try this approach:

DEFINE FILE CAR
PCT_HO_POL/D5%  = IF COUNTRY EQ 'JAPAN' THEN 0 ELSE (SALES / SALES * SEATS);
PCT_FMT/A8      = IF COUNTRY EQ 'JAPAN' THEN 'I6L' ELSE 'D5%';
END
TABLE FILE CAR
PRINT COUNTRY
      PCT_HO_POL/PCT_FMT
END


The advantage of this one over the use of FTOA is that you'll be still dealing with actual numbers so they can be used in SUBTOTALs a/o TOTALs in the report.

Hope that helps,
- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
April 09, 2010, 11:13 AM
Latigresa
quote:
Originally posted by susannah:
quote:
PCT_HO_POL1/A6V=IF AGT_CTY_CD GT '0' AND HO_POL_LMT1 EQ '000000' AND HO_REMN_POL_LMT1 EQ '000000' THEN ' ' ELSE PCT_HO_POL ;


what about
PCT_HO_POL1/D3% MISSING ON =IF AGT_CTY_CD GT '0' AND HO_POL_LMT1 EQ '000000' AND HO_REMN_POL_LMT1 EQ '000000' THEN MISSING ELSE PCT_HO_POL ;


This got me very close to what they are requesting. It places a period (.) in the field. :-)

Thanks for all the quick responses. I will try some of the otheres as well.

Again Thank you! I'm so close now. Big Grin


WEBFOCUS 7.6.4
Server: WINXP
April 09, 2010, 11:17 AM
Latigresa
WOOHOO!! Did a SET NODATA =' ' and that completed my task!!!

THANK YOU EVERYONE!!!

Have a great weekend!


WEBFOCUS 7.6.4
Server: WINXP