Focal Point
(SOLVED)Parameter with conditions

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

August 20, 2015, 05:02 PM
Geoff Fish
(SOLVED)Parameter with conditions
I have an HTML page that Ia amfronting an external procedure with what I am trying to create is a combo box that would give me semstere hours registered for based on several key levels .

The levels are less thaN 6HRS (0-6), more than 6HRS (7-24) more than 9 (10-24) more than 12 (12-24_ and more than 18 (19-24)

I have created a hold file using the DEFINES below to try and facilitate this allowing me to bring dynamic values into the HTML page rather than coding it staticly. Satatic didn't worke either. So if any one can tell me how to write a where satement that would give me LESS than 6 or MORE 6 or MORE than 9 or MORE than 9 or MORE than 12 etc. I would be grateful . I have 2 other instance where I need to use the same strategy..

TOT_HR_RANGE/A10=
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 18 THEN '1' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 12 THEN '2' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 9 THEN '3' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 6 THEN '4' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS LT 6 THEN '5'
ELSE '5';
TOT_HR_DESC/A20=
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 18 THEN '18 or more' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 12 THEN '12 or more' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 9 THEN '9 or more' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS GE 6 THEN '6 or more' ELSE
IF AS_STUDENT_ENROLLMENT_SUMMARY.AS_STUDENT_ENROLLMENT_SUMMARY.TOTAL_CREDIT_HOURS LT 6 THEN 'Less than 6'
ELSE 'N/A";

I was hoping this would allow me to show a description on the HTML page by using

WHERE EXT_ENROLL.SEG01.TOT_HR_RANGE GE '&TOT_HR_RANGE.(FIND EXT_ENROLL.SEG01.TOT_HR_RANGE,EXT_ENROLL.SEG01.TOT_HR_DESC IN ext_enroll).TOT_HR_RANGE.';


The description launches n the HTML page correctly but the issue is the highest value TOT_HR_DESC less than 6 works and the lowest value 18 TOT_HR_DESC or more works but the others in between don't If I pick '9 or more' I only get hrs 10-11and12 no 13-24

I was hoping that this loop below would work but its not. I have tried LE and GE both for the first WHERE but neither works. its if as the 2 WHERE staements are stepping on each other

-IF &TOT_HR_RANGE LE 5 GOTO LOWTOTHRS;

WHERE EXT_ENROLL.SEG01.TOT_HR_RANGE GE '&TOT_HR_RANGE.(FIND EXT_ENROLL.SEG01.TOT_HR_RANGE,EXT_ENROLL.SEG01.TOT_HR_DESC IN ext_enroll).TOT_HR_RANGE.';

-LOWTOTHRS
WHERE EXT_ENROLL.SEG01.TOT_HR_RANGE EQ '&TOT_HR_RANGE.(FIND EXT_ENROLL.SEG01.TOT_HR_RANGE,EXT_ENROLL.SEG01.TOT_HR_DESC IN ext_enroll).TOT_HR_RANGE.';

This message has been edited. Last edited by: Geoff Fish,


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
August 20, 2015, 06:36 PM
j.gross
Your spiel is rather fractured, but I presume you mean you creaate a HOLD file, and then issue the Define for TOT_HR_RANGE and TOT_HR_DESC against the HOLD records., and wish to return only registrants is a single range of total hours.

If your final HTML output is a WF report, then

TABLE FILE myhold
PRINT
...
BY TOT_HR_DESC
BY [registrant key]
WHERE TOT_HR_RANGE EQ &RangeID;
...

should do it (where parameter &RangeID is '1' to '5', per the first define).

There's much that can be improved (think DECODE, COMPUTE, WHERE TOTAL), but the above will get you started.


- Jack Gross
WF through 8.1.05
August 21, 2015, 03:08 AM
GamP
quote:
If I pick '9 or more' I only get hrs 10-11 and 12 no 13-24

Doesn't that make sense?
With a category of 9-24 and 12-24 you should only see 10/11/12 in category 9-24. all other values will fall into another category. If it's less then 9 it will be in category 6-24, if it's more than 12, it will fall in a higher category.
After all:
quote:
The levels are less thaN 6HRS (0-6), more than 6HRS (7-24) more than 9 (10-24) more than 12 (12-24_ and more than 18 (19-24)
effectively means:
less than 6hrs (0-6),
more than 6HRS (7-9),
more than 9 (10-12),
more than 12 (13-18),
and more than 18 (19-24)


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
August 21, 2015, 12:26 PM
Geoff Fish
Actually I mean to have
display result
less than or equal to 6hrs (0-6), TOT_HR_RANGE 5 where TOTAL_CREDIT_HOURS LT 6
more than 6hrs (7-24), TOT_HR_RANGE 4 where TOTAL_CREDIT_HOURS GE 6
more than 9hrs (10-24), TOT_HR_RANGE 3 where TOTAL_CREDIT_HOURS GE 9
more than 12hrs (13-24), TOT_HR_RANGE 2 where TOTAL_CREDIT_HOURS GE 12
and more than 18 (19-24) TOT_HR_RANGE 1 where TOTAL_CREDIT_HOURS GE 18

thanks


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
August 21, 2015, 02:09 PM
Shahram
This is what I would suggest:
1) You do not need any define fields in this case. It will also slow down your report.
2) Create a combo box (or radio button) that is static (not Dynamic)
3) these are the values:

Values---------- description
18 -------18 or more
12 -------12 or more
9 -------9 or more
6 -------6 or more
0 -------less than 6

4) use the sample code bellow

-SET &NWHERE = IF &TOT_HR_RANGE EQ 0 THEN 'WHERE TOTAL_CREDIT_HOURS LT 6' ELSE 'WHERE TOTAL_CREDIT_HOURS GE &TOT_HR_RANGE.EVAL' ;

TABLE FILE ...
PRINT ...
&NWHERE
END


All Releases
All OS, All Outputs
August 24, 2015, 08:20 AM
Geoff Fish
Thanks Shahram I will try that. I initially started with static but coud not get it to work


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
September 01, 2015, 10:28 AM
Geoff Fish
My solution turned out to be not to try and program a solution to WHERE IF ONE VALUE THEN GE ELSE IF ANOTHER VALUE THEN LE but rather to use multiselect OR passing the parameters from the HTML page via drop down box with ALL as the default selection


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