Focal Point
[SOLVED] foc_none OR foc_null

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

November 06, 2017, 04:42 PM
Geoff Fish
[SOLVED] foc_none OR foc_null
I have this code below some of which I found on Focal Point.

My dilemma now is that it works but sometimes there is no middle name in which case i need to ignore it. I can enter the first letter followed by % and it will work but occasionally although rarely a donor may have no middle name in which case I would like the user to not have to enter anything. I tried setting default to % and to foc_none and neither worked.

suggestions are welcome

 
-SET &LASTNAME = LCWORD(&LASTNAME.LENGTH, &LASTNAME, 'A&LASTNAME.LENGTH');
-SET &FIRSTNAME = LCWORD(&FIRSTNAME.LENGTH, &FIRSTNAME, 'A&FIRSTNAME.LENGTH');
-SET &MIDNAME = LCWORD(&MIDNAME.LENGTH, &MIDNAME, 'A&MIDNAME.LENGTH');
-*-SET &2NAME = UPCASE(&2NAME.LENGTH, &2NAME, 'A&2NAME.LENGTH');
-*-SET &3NAME = LOCASE(&3NAME.LENGTH, &3NAME, 'A&3NAME.LENGTH');
TABLE FILE SPRIDEN
PRINT
     SPRIDEN.SPRIDEN.SPRIDEN_PIDM
     SPRIDEN.SPRIDEN.SPRIDEN_ID
     SPRIDEN.SPRIDEN.SPRIDEN_FIRST_NAME
     SPRIDEN.SPRIDEN.SPRIDEN_LAST_NAME
     SPRIDEN.SPRIDEN.SPRIDEN_MI
WHERE ( SPRIDEN.SPRIDEN.SPRIDEN_CHANGE_IND EQ MISSING );
WHERE ( SPRIDEN.SPRIDEN.SPRIDEN_LAST_NAME LIKE '&LASTNAME' );
WHERE ( SPRIDEN.SPRIDEN.SPRIDEN_FIRST_NAME LIKE '&FIRSTNAME' );
WHERE ( SPRIDEN.SPRIDEN.SPRIDEN_MI LIKE '&MIDNAME' );
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/PRDODSP/_EDAHOME/ETC/endeflt.sty,
$
TYPE=DATA,
     COLUMN=N1,
     TARGET='_self',
     FOCEXEC=/WFC/Repository/University_Advancement/universityad/bio/BioDemoMaster11.fex( \
     PIDM=N1 \
     ),
$
ENDSTYLE
END

 

This message has been edited. Last edited by: FP Mod Chuck,


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
November 06, 2017, 05:14 PM
Francis Mariani
Geoff, in the TABLE FILE section of your code, the value "FOC_NONE" will force a bypass of the code. In the Dialogue Manager it will not: the LCWORD causes the problem - it gets transformed to "Foc_None".

Easy test - run this code:

-* File fmfp_geoff1.fex
-SET &ECHO=ALL;

-DEFAULTH &MIDNAME = 'FOC_NONE';

-SET &MIDNAME = LCWORD(&MIDNAME.LENGTH, &MIDNAME, 'A&MIDNAME.LENGTH');

DEFINE FILE CAR
MIDNAME/A10 = LCWORD(10, COUNTRY, 'A10');
END

TABLE FILE CAR
SUM 
SALES
WEIGHT
HEIGHT
BY MIDNAME

WHERE MIDNAME EQ '&MIDNAME';

ON TABLE HOLD
END
-RUN


Now, correct the -SET:

-* File fmfp_geoff1.fex
-SET &ECHO=ALL;

-DEFAULTH &MIDNAME = 'FOC_NONE';

-SET &MIDNAME = IF &MIDNAME EQ 'FOC_NONE' THEN &MIDNAME ELSE LCWORD(&MIDNAME.LENGTH, &MIDNAME, 'A&MIDNAME.LENGTH');

DEFINE FILE CAR
MIDNAME/A10 = LCWORD(10, COUNTRY, 'A10');
END

TABLE FILE CAR
SUM 
SALES
WEIGHT
HEIGHT
BY MIDNAME

WHERE MIDNAME EQ '&MIDNAME';

ON TABLE HOLD
END
-RUN



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 07, 2017, 05:12 AM
Wep5622
...or turn the function calls in your amper-variable values into strings. Those will be subsituted in your TABLE request and only at the point where FOCUS parses your code will those functions be called - that way, FOC_NONE will work as intended.

-SET &MIDNAME = 'LCWORD('|&MIDNAME.LENGTH|', '|&MIDNAME|', ''A'|&MIDNAME.LENGTH|''')';



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
November 14, 2017, 08:43 AM
Geoff Fish
Frances and Wep thanks for your help


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML