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] Using Dynamic Across Field Issue

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Using Dynamic Across Field Issue
 Login/Join
 
Gold member
posted
While I was trying to figure out the best way to use across fields with ASNAMES on I encountered a weird error where it did not recognize the field name from a compute. I can get it to work using a typical repeat and read but I was wondering if anyone had any idea why the compute isn't working?

 -SET &ECHO=ALL;
SET ASNAMES = ON

-SET &TABLE_FILE='HOLDDATA';
-SET &FIELD_AS_NAME='R_COST_';

TABLE FILE CAR
SUM RETAIL_COST AS '&FIELD_AS_NAME'
BY COUNTRY
BY BODYTYPE
ACROSS SEATS
ON TABLE HOLD AS HOLDDATA
END

TABLE FILE SYSCOLUM
SUM COMPUTE COL_LIST/A2000V=IF NAME NE LAST NAME THEN (IF ARGLEN(2000,LAST COL_LIST,'I7') GT 0 THEN COL_LIST || ':' | NAME ELSE NAME) ELSE NAME;
BY NAME
WHERE TBNAME EQ '&TABLE_FILE';
WHERE NAME LIKE '&FIELD_AS_NAME.%';
ON TABLE HOLD AS HOLD_COL
END
-RUN

-SET &COL_NAME='';
-SET &COL_NAMES='';
-REPEAT :LOOP FOR &I FROM 1 TO &RECORDS
-READ HOLD_COL &COL_NAME.A512
-SET &COL_NAMES= &COL_NAMES || ':' || &COL_NAME;
-:LOOP
-SET &COL_NAMES=STRREP(2000,&COL_NAMES,1,':',1,' ',&COL_NAMES.LENGTH,'A&COL_NAMES.LENGTH');

TABLE FILE HOLD_COL
SUM LST.COL_LIST
ON TABLE HOLD AS HOLD_COL
END
-RUN
-READ HOLD_COL &COL_LIST.A2000
-SET &COL_LIST_LEN=ARGLEN(2000,&COL_LIST,'I7');
-SET &COL_LIST=STRREP(2000,&COL_LIST,1,':',1,' ',&COL_LIST_LEN,'A&COL_LIST_LEN.EVAL');

TABLE FILE HOLDDATA
PRINT
&COL_LIST
&COL_NAMES
BODYTYPE
BY COUNTRY
END 

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


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Virtuoso
posted Hide Post
Not sure what you are trying to achieve, but:

-READ HOLD_COL &COL_NAME.A512

should be

-READ HOLD_COL &COL_NAME.A66

which is the length of NAME from SYSCOLUM.

And, because you are using A2000V

-READ HOLD_COL &COL_LIST.A2000

should be

-READ HOLD_COL &dummy.6 &COL_LIST.A2000

to remove the length portion of the output.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Like Alan I'm not really sure what you are trying to do. If you are trying to get the column names from your holdfile, add an asname and print the resulting columns the below would be easier.

If it's something else your after we'll need more details

-SET &ECHO=ALL;
SET ASNAMES = ON

-SET &TABLE_FILE='HOLDDATA';
-SET &FIELD_AS_NAME='R_COST_';

TABLE FILE CAR
SUM RETAIL_COST AS '&FIELD_AS_NAME'
BY COUNTRY
BY BODYTYPE
ACROSS SEATS
ON TABLE HOLD AS HOLDDATA
END
-RUN
DEFINE FILE SYSCOLUM
AS_NAME/A50=' AS '|'Field'|GETTOK(NAME,66,-1,'_',2,'A2');
END
TABLE FILE SYSCOLUM
PRINT
NAME
AS_NAME
WHERE TBNAME EQ '&TABLE_FILE';
WHERE NAME LIKE '&FIELD_AS_NAME.%';
ON TABLE HOLD AS HOLD_COL
END
-RUN
TABLE FILE HOLDDATA
PRINT
-INCLUDE HOLD_COL
BY COUNTRY
BY BODYTYPE
END


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Gold member
posted Hide Post
Basically what I was trying to do was find a good way to use the across asnamed fields from a hold file without using PRINT * or manually entering the field names. It isn't for anything currently just trying it out and testing. It was during that testing that I found that when I got the list of field names using the compute COL_LIST it was saying it didn't recognize the field.

The repeat is just there to show that it works using just &COL_NAMES.

Alan
The reason why I was using A512 on that is because that is the format I was getting with ? HOLD. I tried adding the &dummy but then it wasn't storing any values in &COL_LIST unless I changed it to &dummy.2 instead of &dummy.6. Changing it to a -READFILE also allowed it to work most likely because it does that for me.

Tewy
I tried yours as well but when I use -INCLUDE it is looking for a fex and changing it to the fex name would make a neverending recursive call.


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Expert
posted Hide Post
Don't forget the closing period on the "&COL_NAME.A66", Needs to be "&COL_NAME.A66.", at least in WebFOCUS 8
quote:
-READ HOLD_COL &COL_NAME.A512

should be

-READ HOLD_COL &COL_NAME.A66
And, while you're at it, truncate the &variables that you read in...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Also, consider using asnames and holdlist when holding files that you want to read and truncating the results of your read, and so much more...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Gold member
posted Hide Post
Doug
Hmm didn't know about the read needing a closing period after the format that is good to know.

Also I am not quite sure I am understanding your second post. What are you meaning by truncating the results of my read? I am taking out any trailing spaces before using. Also I didn't include the sets that I normally include but is the following kind of what you were talking about?
SET ASNAMES = ON
SET BYDISPLAY = ON
SET FIELDNAME = NOTRUNC
SET EMPTYREPORT = ANSI
SET HOLDLIST = PRINTONLY
SET DATETIME = NOW 


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Expert
posted Hide Post
SET ASNAMES = ON
SET BYDISPLAY = ON - N/A to this issue
SET FIELDNAME = NOTRUNC - N/A to this issue
SET EMPTYREPORT = ANSI - N/A to this issue
SET HOLDLIST = PRINTONLY
SET DATETIME = NOW - N/A to this issue

The truncate command is better then this:
-SET &COL_NAMES=STRREP(2000,&COL_NAMES,1,':',1,' ',&COL_NAMES.LENGTH,'A&COL_NAMES.LENGTH');
imho...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Gold member
posted Hide Post
Doug
Ah thanks I didn't know about the truncate function, hence my confusion, but that is quite useful with dialogue manager commands.

I will put solved on this though since the main issue seemed to have been my -READ was storing the length portion into the variable but wasn't displaying that.

Thanks Alan, Tewy, and Doug learned a bit more from all of your posts.


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report 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] Using Dynamic Across Field Issue

Copyright © 1996-2020 Information Builders