Focal Point
Defining a field

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

October 03, 2007, 01:02 PM
WP10601
Defining a field
Silly question but I cant find resolution to this.

I take fields/parms from a html page and import into webfocus and run a report.

if the fields are not populated on html then the webfocus seems to have an issue

I have fields XCODE1 thru 10 which come from Html. Each field is populated (drop down flds) is a 6 char string which must be unwrapped into 2 seperate fields TYPE1 AND CODE1 etc.
I use the subsrtr to get these two fields if XCODE is gt ' '.

Now here is the thing - if XCODE2 is not populated (selected) it does not seem to be picked up from the HTML and causes an error, because TYPE2 and CODE2 etc are only built by the substr cmd.


How do I define a field ahead of the test to rebuild/populate them via the test if XCODE GT ' ' then CODE1 = substr... and CODE2 = substr...

If you catch my drift.



If typ
October 03, 2007, 01:10 PM
Francis Mariani
This is normal behaviour for HTML forms.

I would add -DEFAULT statements to the top of my FOCEXEC.

-DEFAULT &XCODE2 = '';

Then, if the field is passed you will have a value to SUBSTR with, if it is not passed, it will default to blank.


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
October 03, 2007, 01:12 PM
Leah
Have you tried setting a default value in the fex itself or checking for the length of the existence of the data first. Heres a snippit from when we do a fex that expects parameters looking for the existence:
-SET &SIDLIST  = IF &SIDLIST.EXIST NE 0 THEN &SIDLIST ELSE 'HOLD';
-SET &SORTBY   = IF &SORTBY.EXIST NE 0 THEN &SORTBY ELSE 'Z';
-SET &BYFIELD  = IF &SORTBY EQ 'A' THEN 'STU_NAME' ELSE 'AD260';
-SET &ADDR     = IF &ADDR.EXIST NE 0 THEN &ADDR ELSE 'PLB';


I don't do a lot of dialog manager, but hope it helps


Leah
October 10, 2007, 03:34 PM
WP10601
Thanks for replying the DEFAULT &(fld name)
worked a dream.