Focal Point
[Solved]Dynamic Parameter Loading

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

October 13, 2008, 03:00 AM
Surenther
[Solved]Dynamic Parameter Loading
Hai
We need Year,Month and the corresponing days for that month (example For Jan 1,2,3...31 and For Feb 1,2,3..28or29) as a parameter
For these we have cratead the following Procedure

FILEDEF DATEMAS DISK DATERNG.MAS
-RUN
-WRITE DATEMAS FILE=DATERNG,SUFFIX=XFOC
-WRITE DATEMAS SEGNAME=SEG1
-WRITE DATEMAS FIELD=DATE_KEY, ,DMYY ,DMYY , $
-RUN
CREATE FILE DATERNG
MODIFY FILE DATERNG
FREEFORM DATE_KEY.A8.
LOG FORMAT MSG OFF
LOG TRANS MSG OFF
LOG INVALID MSG OFF
DATA
-* Any invalid dates will be rejected.
-PROMPT &Year.(2000,2001,2002,2003,2004,2005,2006,2007,2008);
-PROMPT &Month.(1,2,3,4,5,6,7,8,9,10,11,12);
-DEFAULT &Year = '2000';
-DEFAULT &Month = '2';
-SET &Day = 1;
-REPEAT :Loop1 31 TIMES;
-SET &Date = IF &Day LT 10 THEN '0' || &Day ELSE &Day;
-SET &Mnth = IF &Month LT 10 THEN '0' || &Month ELSE &Month;
&Date&Mnth&Year
-SET &Day = &Day + 1;
-:Loop1
END
-RUN
DEFINE FILE DATERNG
DAY/D = DATE_KEY
END
TABLE FILE DATERNG
SUM FST.DAY
BY DAY
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT XML
ON TABLE SET HTMLCSS ON
END

When we Call this Procedure for loading dropdown box in HTML layout Painter We did not get any Output and also How can we Pass these parameters to our main prodcedure

Please Help us in this issues

Thanks

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


----------------------------------
Prod Version:WebFocus 8.1.05,OS:Unix ,Output:ALL
October 13, 2008, 03:22 AM
<JG>
Why do you not just use the calendar functionality in the HTML painter?

If the associated variable is part of your form it will be passed automatically.
October 13, 2008, 03:50 AM
Tony A
Surenther,

Nice to know that code I've posted is being used! Do you understand what it is actually doing?

I agree with JG, why not use the calendar within painter?

Oh, and as a pointer, you will not be able to use -PROMPT within a fex used to populate a dropdown.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 13, 2008, 03:54 AM
Surenther
Yes Tony we take Your Code Only

We used the calender control its worked fine But our requirements is dropdown box

Is there anyother way to acheive this?

Thanks For spending your valuable time

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


----------------------------------
Prod Version:WebFocus 8.1.05,OS:Unix ,Output:ALL
October 13, 2008, 04:54 AM
Tony A
Surenther,

There are probably many ways of achieving a populated dropdown, but it all depends on what your actual requirement is. I would suggest giving it some thought and working out what you actually need to do.

As I have said before (not to you but in other posts) think laterally about a problem and often you will find a way to achieve what you need.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 15, 2008, 03:59 AM
Surenther
Hai We done it by using the following codes.We Created 3 procedures for year,month and date

For year

FILEDEF DATEMAS DISK DATERNG.MAS
-RUN
-WRITE DATEMAS FILE=DATERNG,SUFFIX=XFOC
-WRITE DATEMAS SEGNAME=SEG1
-WRITE DATEMAS FIELD=DATE_YEAR, ,I4,I4,$
-WRITE DATEMAS FIELD=DATE_MON, ,I2,I2,$
-WRITE DATEMAS FIELD=DATE_KEY, ,A8 ,A8 , $
-RUN
CREATE FILE DATERNG
MODIFY FILE DATERNG
FREEFORM DATE_YEAR.I4. DATE_MON.I2. DATE_KEY.A8.
DATA
-DEFAULT &Year = 1989;
-REPEAT :Loop2 2 TIMES;
-SET &Month = 1;
-REPEAT :Loop1 12 TIMES;
-SET &Day = 1;
-SET &CNT=IF (DMOD(&Year,4,I2)EQ 0 ) AND (&Month EQ 2) THEN '29' ELSE IF (&Month EQ 2) THEN '28' ELSE IF &Month EQ '1' OR '3' OR '5' OR '7' OR '8' OR '10' OR '12' THEN '31' ELSE '30';
-REPEAT :Loop3 &CNT TIMES;
&Year
&Month
-SET &Date = IF &Day LT 10 THEN '0' || &Day ELSE &Day;
-SET &Mnth = IF &Month LT 10 THEN '0' || &Month ELSE &Month;
&Date
-SET &Day = &Day + 1;
-:Loop3
-SET &Month = &Month + 1;
-:Loop1
-SET &Year = &Year + 1;
-:Loop2
END
-RUN

TABLE FILE DATERNG
PRINT DST.DATE_YEAR
BY DATE_YEAR
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT XML
END

For Month

We modified the last report like this

TABLE FILE DATERNG
PRINT DST.DATE_MON
BY DATE_YEAR
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT XML
END

For Date

TABLE FILE DATERNG
PRINT DST.DATE_KEY
BY DATE_YEAR
BY DATE_MON
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT XML
END


Then we load these Procedure to 3 dropdown boxes in HTML and we use the chained function for the relationship

Tony Thanks for your Code we used your Code as a model


----------------------------------
Prod Version:WebFocus 8.1.05,OS:Unix ,Output:ALL