Category Archives: Uncategorized

Enable Date Control in Page Designer

If you want to use a datepicker control in Page designer, there are a couple of steps you have to take.

When you add content to a Page, if it has a date parameter, you need to explicitly set the parameters default format.

For example, if the name of your date parameter is &START_DATE, then do the following at or near the top of your procedure:

-DEFAULT &START_DATE = &START_DATE.(|FORMAT=YYMD).QUOTEDSTRING;

Or

in your WHERE Clause

WHERE SALES_DATE EQ &START_DATE.(|FORMAT=YYMD).QUOTEDSTRING;

Page Designer will now recognize it as a date type, and will default the parameter control to a datepicker.

If you need to use the date selected in a calculation, then you’ll need do some coding as the date is passed as a string in the format “[Full Month Name] [1 or 2 digit day of month] [4 Digit Year]:

-DEFAULT &START_DATE = &START_DATE.(|FORMAT=YYMD,SORT=ASCENDING).QUOTEDSTRING;

-DEFAULT &END_DATE = &END_DATE.(|FORMAT=YYMD,SORT=ASCENDING).QUOTEDSTRING;

-TYPE  &START_DATE to &END_DATE

-SET &START_MONTH_TOKEN = TOKEN(&START_DATE.QUOTEDSTRING,’ ‘,1);

-SET &START_DAY_TOKEN = REPLACE(TOKEN(&START_DATE.QUOTEDSTRING,’ ‘,2),’,’,”);

-SET &START_YEAR = TOKEN(&START_DATE.QUOTEDSTRING,’ ‘,3);

-SET &START_MONTH = DECODE &START_MONTH_TOKEN(‘January’ ’01’ ‘Febuary’ ’02’ ‘March’ ’03’ ‘April’ ’04’ ‘May’ ’05’ ‘June’ ’06’ ‘July’ ’07’ ‘August’ ’08’ ‘September’ ’09’ ‘October’ ’10’ ‘November’ ’11’ ‘December’ ’12’ );

-SET &START_DAY = IF EDIT(&START_DAY_TOKEN) GE 10 THEN &START_DAY_TOKEN ELSE ‘0’|&START_DAY_TOKEN;

-SET &START_DATE_YYMD =  ‘&START_YEAR.EVAL/&START_MONTH.EVAL/&START_DAY.EVAL’;

-SET &END_MONTH_TOKEN = TOKEN(&END_DATE.QUOTEDSTRING,’ ‘,1);

-SET &END_DAY_TOKEN = REPLACE(TOKEN(&END_DATE.QUOTEDSTRING,’ ‘,2),’,’,”);

-SET &END_YEAR = TOKEN(&END_DATE.QUOTEDSTRING,’ ‘,3);

-SET &END_MONTH = DECODE &END_MONTH_TOKEN(‘January’ ’01’ ‘Febuary’ ’02’ ‘March’ ’03’ ‘April’ ’04’ ‘May’ ’05’ ‘June’ ’06’ ‘July’ ’07’ ‘August’ ’08’ ‘September’ ’09’ ‘October’ ’10’ ‘November’ ’11’ ‘December’ ’12’ );

-SET &END_DAY = IF EDIT(&END_DAY_TOKEN) GE 10 THEN &END_DAY_TOKEN ELSE ‘0’|&END_DAY_TOKEN;

-SET &END_DATE_YYMD =  ‘&END_YEAR.EVAL/&END_MONTH.EVAL/&END_DAY.EVAL’;

-*Where &START_DATE_YYMD and &END_DATE_YYMD are in the format YYYY/MM/DD

Limit records return on a synonym

For the rare case that you need to restrict the number of records returned in a synonym, here’s the syntax to add to the synonym in the text editor :

END

DBA=DBA, $

USER=, ACCESS=R, RESTRICT=VALUE, NAME=SYSTEM, VALUE=READLIMIT EQ 100;, $

I’ve highlighted the ‘100’ to show you where you set the limit.

For more information on this, check out the following WebFOCUS documentation. Search for “Providing Data Source Security: DBA”

So what happened to my previous postings?

For those who have visited my blog before, you’ll notice that I don’t have any posts before November 2013. Well, that’s because my old hosting service decommissioned the server without letting me know.

Always the eternal optimist, I see this as an opportunity to reboot my blog. I’m going to revisit a few concepts including some data visualization techniques and WebFOCUS specific examples.

I hope to have something new up later this week.