Jump to content

Hello All, Need help with populating slider bar values dynam...


Lucky .

Recommended Posts

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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...