Lucky . Posted April 29, 2021 Share Posted April 29, 2021 Hello All, Need help with populating slider bar values dynamically instead of hardcoding.when i hardcode the year to 1996 and 1997 code works fine and i see slider bar but when i use amper variables &OYRAGE and &NYRAGO then i get input box instead of slider bar. please refer to the following code below. Comment and uncomment slider bar where filter condition to see both the scenario results. SET HOLDLIST = PRINTONLY -DEFAULT &SORT_YR = 1996; -SET &OYRAGO = DATECVT(DATEMOV(DATEADD(DATECVT(&YYMD,I8YYMD,YYMD), Y,-25, BOY), YYMD,YY); -SET &NYRAGO = DATECVT(DATEMOV(DATEADD(DATECVT(&YYMD,I8YYMD,YYMD), Y,-24, BOY), YYMD,YY); -SET &STAT = &PRODT.(<All,All>,<Hazelnut,Hazelnut>,<Biscotti,Biscotti>,<Mug,Mug>).Product ; -SET &WHEREPROD = IF &PRODT EQ Hazelnut THEN WHERE PRODUCT_DESCRIPTION EQ Hazelnut -ELSE IF &PRODT EQ Biscotti THEN WHERE PRODUCT_DESCRIPTION EQ Biscotti -ELSE IF &PRODT EQ Mug THEN WHERE PRODUCT_DESCRIPTION EQ Mug -ELSE IF &PRODT EQ All THEN WHERE PRODUCT_DESCRIPTION EQ Mug OR Croissant OR Hazelnut OR Biscotti ; -SET &WHEREYR = IF &SORT_YR EQ &OYRAGO THEN WHERE ORDER_YR EQ &OYRAGO -ELSE IF &SORT_YR EQ &NYRAGO THEN WHERE ORDER_YR EQ &NYRAGO -ELSE IF &SORT_YR EQ All THEN WHERE ORDER_YR EQ &NYRAGO OR &OYRAGO ; -********************************** TABLE FILE GGORDER PRINT QUANTITY UNIT_PRICE COMPUTE ORDER_YR/YY= DATECVT(ORDER_DATE,MDY,YY); BY ORDER_DATE BY PRODUCT_ID BY PRODUCT_DESCRIPTION &WHEREPROD &WHEREYR ON TABLE HOLD AS GGHOLD1 END -RUN TABLE FILE GGHOLD1 SUM UNIT_PRICE BY ORDER_YR BY PRODUCT_ID BY PRODUCT_DESCRIPTION WHERE ORDER GE &SORT_YR(FROM 1996 TO 1997|FORMAT =I4,REQUIRED=TRUE).Year selection:.QUOTEDSTRING; -*WHERE ORDER GE &SORT_YR(FROM &OYRAGE TO &NYRAGE|FORMAT =I4,REQUIRED=TRUE).Year selection:.QUOTEDSTRING; END -RUN Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted May 3, 2021 Share Posted May 3, 2021 Hi Lucky What version of WebFOCUS are you using Link to comment Share on other sites More sharing options...
David Beagan Posted May 3, 2021 Share Posted May 3, 2021 There is an error in your code, unbalanced parenthesis in the first two -SET statements. Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted May 3, 2021 Share Posted May 3, 2021 And then once you get past that it doesnt like BOY on the DATEADD at least in 8207.26 Link to comment Share on other sites More sharing options...
Lucky . Posted May 3, 2021 Author Share Posted May 3, 2021 WebFOCUS Version is 8207.06 Link to comment Share on other sites More sharing options...
Lucky . Posted May 3, 2021 Author Share Posted May 3, 2021 Oops while copying i missed it. here you go -SET &OYRAGO = DATECVT(DATEMOV(DATEADD(DATECVT(&YYMD,I8YYMD,YYMD), Y,-25), BOY), YYMD,YY); -SET &NYRAGO = DATECVT(DATEMOV(DATEADD(DATECVT(&YYMD,I8YYMD,YYMD), Y,-24,) BOY), YYMD,YY); Link to comment Share on other sites More sharing options...
Lucky . Posted May 3, 2021 Author Share Posted May 3, 2021 Can someone suggest what should I use instead of BOY in DATEADD to make my code work Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted May 3, 2021 Share Posted May 3, 2021 Yeah I am really lost as to why you are using all those functions together what is the result you are really trying to achieve. Link to comment Share on other sites More sharing options...
Lucky . Posted May 3, 2021 Author Share Posted May 3, 2021 Instead of hardcoding the years on the slider bar i want to populate them dynamically using ampere variables. FROM TO In the following code i am hardcoding 1996 and 1997 but i dont want to do that. they should be populated based on ampere variables. WHERE ORDER GE &SORT_YR(FROM 1996 TO 1997|FORMAT =I4,REQUIRED=TRUE).Year selection:.QUOTEDSTRING; Link to comment Share on other sites More sharing options...
David Beagan Posted May 3, 2021 Share Posted May 3, 2021 I dont think what you are trying to do can be done all in the reporting fex procedure. In my testing, you cant have &SORT_YR.(FROM &FromYear TO &ToYear). with variables for the FROM and TO values. But I think you can accomplish it with a fex that runs prior to your report. For example, it could run in the global server profile. For example, you could run this first: -SET &SLIDERSTART = &DATEYY - 9; -SET &SLIDEREND = &DATEYY - 1; FILEDEF begrange DISK foccache/begrange.fex FILEDEF endrange DISK foccache/endrange.fex -RUN -WRITE begrange &|BEG_YR.(FROM &SLIDERSTART TO &SLIDEREND).Select Beginning Year. -WRITE endrange &|END_YR.(FROM &SLIDERSTART TO &SLIDEREND).Select Ending Year. so this will create some code files on foccache that are based on whatever values you set for &SLIDERSTART and &SLIDEREND. Now the report would use them like this: DEFINE FILE ggsales ORDER_YR/YY = SEQ_NO; END TABLE FILE ggsales PRINT ORDER_YR UNITS BY REGION BY ST BY CITY WHERE ORDER_YR GE -MRNOEDIT -INCLUDE begrange WHERE ORDER_YR LE -MRNOEDIT -INCLUDE endrange END When this report is run you get prompted with sliders, and can select a beginning and ending year within the range of each slider. image.png478505 12.7 KB Then when the report is run you just get the range of selected years. You should be able to test this out in your environment. Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted May 3, 2021 Share Posted May 3, 2021 OK One more question Is the slider bar on a html form created with HTML composer Link to comment Share on other sites More sharing options...
Lucky . Posted May 4, 2021 Author Share Posted May 4, 2021 Thank you so much for the solution. i will try this out. Link to comment Share on other sites More sharing options...
Lucky . Posted May 4, 2021 Author Share Posted May 4, 2021 i am assembling my controls using InfoApp1 instead of HTML composer. Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted May 4, 2021 Share Posted May 4, 2021 That is new to me I have never heard of InfoApp1 How do you invoke InfoApp1 Link to comment Share on other sites More sharing options...
Lucky . Posted May 4, 2021 Author Share Posted May 4, 2021 In WebFOCUS designer click on Assemble visualizations instead of new visualization. You will get a pop-up window to choose Template. select InfoApp1. You can drag and drop a FEX in the content panel and select the controls. You will get control options based on the filter conditions specified in the FEX. Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted May 4, 2021 Share Posted May 4, 2021 Thank you I found that and will give it a try but I will warn you this is my first experience with Designer, I am an old school WebFOCUS guy Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted May 5, 2021 Share Posted May 5, 2021 Well I have come to the conclusion that unless you use Dave Beagans methodology which does the autoprompt you cant have a dynamic value based on a variable in a slide bar within designer or html composer. Of course you always have the option of opening a case with techsupport Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now