Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]dynamic columns on report

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]dynamic columns on report
 Login/Join
 
Silver Member
posted
I have a subsequent issue I am trying to resolve now regarding language translation. I have an HTML page with a double list selection box. The HTML page passes the field name(s) as it exists in the table to fulfill a variable in the fex called &COL. So, using the car file, I might have COUNTRY CAR and MODEL on the report and the next person that might run this report might ask for COUNTRY CAR MAKE and MODEL on the report, etc etc. The HTML operation that is passed is 'AND' so the Print statement in the fex comes out PRINT COUNTRY AND CAR AND MODEL, etc etc. Ok, so..now...lets say the person requesting the report is asking for their data to come back in French. The double list select box will display the fields to choose in French..but under the covers passes the field name. Once that comes in to satisfy the &COL variable I need to get those field names into their French translation. Were it a static list of fields every time the report is run, no problem. But it is dynamic, with 47 fields in the list and any possible order the user wants to see.
Any suggestions?

This message has been edited. Last edited by: MonkeyP,


release 7.7.03M
OS - Linux
HTML, PDF, Excel, Delimited files, Graphs, Dashboards, MRE, Report Caster
 
Posts: 35 | Registered: December 13, 2011Report This Post
Master
posted Hide Post
interesting. Assuming the fex receives a string like you say COUNTRY AND CAR AND MODEL, then you could do a GETTOK and seperate the tokens with ' AND ' (notice spaces). Then do a FOR loop to spit out the field names with a .EVAL (i.e. &VAR_NAME.EVAL AS '&VARNAME').

This is coming out jumbled -- I did something similar where I had to loop through days, looking at each day individually (not as a range). I used a FOR loop to do this and then wrote each to a hold file with the loop number in it. Later, I stitched them back together using another loop to write out the WebFOCUS code in the middle of a MORE FILE routine. The .EVAL caused it to be seen as code and executed. Yours will be a little different in that you don't have a loop that increments, so you have to fool it by tokenizing the string.

I hope this helps.
- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Virtuoso
posted Hide Post
With a multi-select HTML object, WebFOCUS creates an array for the variable. For example, your &COL becomes &COL, &COL1, &COL2, &COL3, &COL4, etc. But based on your previous post, where you mentioned the use of a translation table, you might be able to do something like this:

DEFINE FILE translation_table
 QUOTE/A1 = ''';
 PRINT_COL/A50 = COL_NAME | ' AS ' | QUOTE || COL_TITLE || QUOTE ;
END
-* 
TABLE FILE translation_table
 PRINT PRINT_COL
 WHERE (COL_NAME EQ '&COL');
 WHERE (LANGUAGE EQ 'FRENCH');
 ON TABLE SAVE AS PRINT_COLS
END
-*
TABLE FILE data_table
 PRINT
-INCLUDE PRINT_COLS
END

EDIT: Sorry, I forgot about the ANDed values in &COL. Therefore, you would need to separate the values in order to 'OR' them for the translation table query:

DEFINE FILE translation_table
 QUOTE/A1 = ''';
 PRINT_COL/A50 = COL_NAME | ' AS ' | QUOTE || COL_TITLE || QUOTE ;
END
-* 
TABLE FILE translation_table
 PRINT PRINT_COL
 WHERE LANGUAGE EQ 'FRENCH';
 WHERE COL_NAME EQ '&COL1'
-SET &I = 2 ;
-REPEAT ENDREPEAT WHILE &COL.&I.EXISTS ;
    OR '&COL.&I.EVAL'
-SET &I = &I + 1 ;
-ENDREPEAT
;
 ON TABLE SAVE AS PRINT_COLS
END
-*
TABLE FILE data_table
 PRINT
-INCLUDE PRINT_COLS
END

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Silver Member
posted Hide Post
ok, thanks for giving me something to get my brain going. I will work on this over the weekend and let you all know how it comes out.

Thanks!

Wendy


release 7.7.03M
OS - Linux
HTML, PDF, Excel, Delimited files, Graphs, Dashboards, MRE, Report Caster
 
Posts: 35 | Registered: December 13, 2011Report This Post
Master
posted Hide Post
Thanks Dan, that looks like a fleshed out version of what I was trying to describe.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Silver Member
posted Hide Post
Well, GETTOK only returns the first character of any token you identify..so if the operations is AND it is only returning the 'A'. Secondly, I am using a double list control box, not a mutliselect list box, and it is actually NOT returning multiple &variable values. It is returning the value for &COL as COUNTRY AND MAKE AND MODEL. If I query the variables with ? & it doesn't show &COL and &COL1 and &COL2 etc etc...it only shows &COL. Any additional suggestions?


release 7.7.03M
OS - Linux
HTML, PDF, Excel, Delimited files, Graphs, Dashboards, MRE, Report Caster
 
Posts: 35 | Registered: December 13, 2011Report This Post
Virtuoso
posted Hide Post
Maybe something like this. Use function STRREP to replace all ' AND ' with commas in order to generate a comma-delimited list of column names. Use this column list in your query. You may have to adjust the STRREP function to put single quotes around each of the column names.

-SET &COL_LIST = STRREP(&COL.LENGTH,&COL.QUOTEDSTRING,5,' AND ',1,',',&COL.LENGTH,'A&COL.LENGTH.EVAL');
-*
DEFINE FILE translation_table
 QUOTE/A1 = ''';
 PRINT_COL/A50 = COL_NAME | ' AS ' | QUOTE || COL_TITLE || QUOTE ;
END
-* 
TABLE FILE translation_table
 PRINT PRINT_COL
 WHERE (COL_NAME IN (&COL_LIST));
 WHERE (LANGUAGE EQ 'FRENCH');
 ON TABLE SAVE AS PRINT_COLS
END
-*
TABLE FILE data_table
 PRINT
-INCLUDE PRINT_COLS
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Silver Member
posted Hide Post
Boy, I fought and fought with this. GETTOK wouldn't behave properly..and neither would STRREP. In an act of desperation, I replaced the "AND" operation in the HTML code with just a space (" ") and now the field names, no matter how many and in what order, come across as a list so now I can match them to the translation table and produce the report in the correct language.
Go figure.....


release 7.7.03M
OS - Linux
HTML, PDF, Excel, Delimited files, Graphs, Dashboards, MRE, Report Caster
 
Posts: 35 | Registered: December 13, 2011Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]dynamic columns on report

Copyright © 1996-2020 Information Builders