Posts

IBI WebFOCUS - Renaming Excel report file name generated

Image
Dear friends, While creating the Excel report, the name of the excel file comes randomly with normal scenario if we give "PCHOLD FORMAT EXL07". I recently came to a scenario where the business user wanted the excel report name to come as per the report name. Please note that user wanted to rename Excel file name not the tab names in the file. In general we right our code as below: TABLE FILE CAR SUM      CAR.BODY.SEATS      CAR.BODY.DEALER_COST      CAR.BODY.RETAIL_COST      CAR.BODY.SALES BY  CAR.COMP.CAR BY  CAR.CARREC.MODEL ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET ASNAMES ON ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT EXL07 ON TABLE SET HTMLEMBEDIMG ON ON TABLE SET HTMLCSS ON ON TABLE SET STYLE *      INCLUDE = endeflt, $ ENDSTYLE END Output: However if we need to name the Excel file, we can use below code: TABLE FILE CAR SUM      CAR.BODY.SEATS      CAR.BODY.DEALER_COST      CAR.BODY.RETAIL_COST      CAR.BODY.SALES BY  CAR.COMP.CAR

IBI WebFOCUS - Dynamic Column control using Double-List box

Image
Hi Friends, After along time, I got something interesting to share with all of you. Sometimes back I have worked on a report where user wanted option to select the columns he wants to display in the report. In other words we can say user needed self-service kind of option same as we have with InfoAssist where user can select the columns which he wantsto print in the report. Similar requirement we had to achieve using double-list box in HTML launch page. I have taken a simple example using CAR file and few columns (COUNTRY, CAR, MODEL, SALES, DEALER_COST). This can be exyended to n number of columns. So first of all, I created asimple launch page as below screen shot: The double list box is defaulted to COUNTRY column. Which means if we run the report for default, we will get only COUNTRY columns printed in the report. However in the next screen shot we have selected 4 columns and the output is displayed in the below screen shot. Selection Screen:   Output Screen:

IBI WebFOCUS - Formatting and aligining Across values in PDF output

Image
Dear Developers,  Recently I was working on a simple report using across. We had to justify values and data to right. It worked fine in HTML but when I generate the report in PDF, the issue I was facing is with the alignment. The data doesn't seems to appear properly aligned.  Please look at the screenshot: Initially it looked very simple but when I started looking for the alignment, it took pretty much of my time. So I thought it is worth sharing with all of you. Below is the sample code using CAR file: TABLE FILE CAR SUM SALES/D12.1 AS '' BY COUNTRY AS '' ACROSS CAR AS '' ON TABLE PCHOLD FORMAT PDF ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=REPORT,GRID=ON,SQUEEZE=ON, SIZE=7,$ TYPE=ACROSSVALUE,BACKCOLOR = GREY,COLOR=WHITE,STYLE=BOLD, JUSTIFY=RIGHT,WRAP=0.60,$ TYPE=REPORT,ACROSSCOLUMN=SALES,JUSTIFY=RIGHT,$ TYPE =ACROSSTITLE, BACKCOLOR = GREY,$ ENDSTYLE END And Screen shot of the output: Please share your

IBI WebFOCUS - Restricting calendar date range on the launch page dynamically using WebFOCUS procedure

Image
Dear Developers,  Recently we received a requirement where on the launch page, we wanted to restrict the user to select the dates in a specified date range. The requirement basically came up because in calendar, user can select 10 years past and future dates from current year. There is no point in allowing user to select a date for which data is not available or it is not relevant for the report. We can simply do this if the range is static and not going to change in future however that is not the scenario. We would need to do this from WebFOCUS procedure so that if the range changes in future, it should automatically reflect in the launch page. First for all, we would need to create a .fex file which will have similar content (here I am 4 years past and 3 years future dates) :  -* File: IBFS:/localhost/EDA/EDASERVE/APPPATH/pravin/purge_date.fex Created by WebFOCUS AppStudio DEFINE FILE CENTURYCUSTOMERS StDt1/MDYY=&MDYY; StDt2/MDYY=DATEADD(StDt1,'Y',-4); StDt3/M

Feedback/Suggestions on completion of this year

Image
Dear Professionals, I started writing this blog more than a year ago. The purpose of this blog was to help the people with day to day coding in WebFOCUS. I also use the codes for my reference as well. Whenever I put some effort to resolve a problem or find some solution, and I feel it could be used in future also either by myself or it can benefit to others, I share it on this blog. As we all know feedback is always a good motivation. I request all of you to please share your feedback/ suggestions on the same if you have any. If you want me to share on some specific topic or some common issue. Is it really helping you? If not? What else we can do to make it helpful? If you have something to share, send it to my mail id er.pravin007@gmail.com. I'll publish it over there with your name as presenter. I long run, this can become a place where you can find code for most of your day to day solutions. In last 6-8 months, I started liking WebFOCUS 8 version (initially I found it h

IBI WebFOCUS - Finding Run Time Stamp in A.M./P.M. format

Almost all reports (including WebFOCUS) usually need to show Report Run Date and Time. WebFOCUS provides us the variables &DATE and &TOD(system variables) to get system date and time and use it in our report without calculating anything in the procedure. However in some of the report we need to show time stamp in a.m./p.m. format. I have created the logic and I feel that sharing it might save some hours of development time for developers looking for such requirement. Below is the piece of code you can put in your procedure and you can use &TOD2 in your report header. -SET &M=''; -SET &H1 = EDIT(&TOD,'99'); -SET &H2 = IF &H1 GT 12 THEN &H1 - 12 ELSE &H1; -SET &M = IF &H1 GT 12 THEN ' PM' ELSE ' AM'; -SET &TOD2 = &H2 | EDIT(&TOD,'$$$:99$') | EDIT(&TOD,'$$$:$$$99') | &M; -TYPE &TOD -TYPE &TOD2 Please share your thoughts/ feedback's.  Happy coding

IBI WebFOCUS - Finding prior/future dates from current date

I have come across the situation many a times where we need to filter report data for: 1) 6 months prior to selected/system date. 2) Report should pull data for date greater than last 30 days. 3) Any other situation where you need 30 days prior, 1 year future date, 3 months after date from system date etc. I feel it is worth sharing the below piece of code: -SET &DATEINPUT = EDIT('&DATEYYMD.EVAL','9999$$$$$$')||EDIT('&DATEYYMD.EVAL','$$$$$99$$$')||EDIT('&DATEYYMD.EVAL','$$$$$$$$99'); -TYPE &DATEINPUT -SET &DATE_30 = DATECVT((DATEADD((DATECVT(&DATEINPUT, 'I8YYMD', 'YYMD')), 'D', -30 )), 'YYMD', 'I8YYMD'); -TYPE IN: &DATEINPUT / OUT: &DATE_30 In above example, I calculated date which is 30 days prior to currect date. In place of 'D', we can have 'M', 'Y' and 'BD' for Months, Year and Business days. If you need to calcula