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     Can I assign a field name to an &var?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Can I assign a field name to an &var?
 Login/Join
 
<Jim Rich>
posted
I want to assign Defined Field Name to an &var to I can display it in other than a Heading section.

TD/YYM- = '&thrud';
FD/YYM- = TD - 11;
ADATE/A6YYM-=FD;
BDATE/A8=ADATE;
CDATE/A8=EDIT(BDATE,'9999')||('-'||EDIT(BDATE,'$$$$99'));

CDATE contains the value I want to use.
I have tried:
SET &cdate = CDATE
-SET &cdate = CDATE
-DEFAULT &cdate = CDATE
&cdate =
All of the above with/without the < and '' with no luck. The most I get is nothing or CDATE rather than the value of CDATE.

Any clues?
 
Report This Post
Expert
posted Hide Post
take the ' away from your &var;
TD/YYM- = '&thrud';
should be
TD/YYM = &thrud ;
also, that dash - after the format YYM-
is goofy; whats up with that?
In your code below, you want to read out to an &var.
you have 2 choices;
1) do all the date calcs in dialog manager. (best way)
2) after the defines,write the CDATE out to a file, then READ the file with a -READ , setting your new &var.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
<Jim Rich>
posted
Here is a larger part of the code
I need '&thrud' with the quotes because it is coming in as an text string. My problem is how to set &cdate to equal to value of CDATE rather than the word in both my ACROSS statement and my Heading.

DEFINE FILE LOG_KPI_SMRY ADD
TD/YYM- = '&thrud';
FD/YYM- = TD - 11;
ADATE/A6YYM-=FD;
BDATE/A8=ADATE;
CDATE/A8=EDIT(BDATE,'9999')||('-'||EDIT(BDATE,'$$$$99'));
DEFCNT/I6 WITH JOB_OID = IF JOB_OID IS MISSING THEN 0 ELSE 1;
SUB_PSL_NM/A64 WITH SUB_PSL_NM = 'Global';
END
-SET &cdate = CDATE

TABLE FILE LOG_KPI_SMRY
SUM
SUB_PSL_NM NOPRINT OVER
DEFCNT AS 'Number of Jobs' OVER
LT_JOB_FLG AS 'Number of Lost Time Jobs' OVER
TOT_NBR_SRVC AS 'Number of Services' OVER
....
COMPUTE SERV1/D12.2 = TOT_NBR_SRVC / NBR_LT_FAIL; AS 'Services per LT Failure' OVER
COMPUTE SERV2/D12.2 = TOT_NBR_SRVC / DEFCNT; AS 'Services per Jobs'

WHERE ( JOB_YR_MO GE CDATE );
WHERE ( JOB_YR_MO LE '&thrud' );
LIKE '&loc' ) OR ( PLNT_NM LIKE '&loc' );
WHERE ( PRNT_CUST_NM LIKE '&custname' ) OR ( CUST_NM LIKE '&custname' );
WHERE ( SUB_PSL_NM LIKE '&subpsl' );
ACROSS SUB_PSL_NM AS '&cdate - &thrud'

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
HEADING
" KPI Comparison Report "
" &cdate - &thrud "
END
 
Report This Post
Expert
posted Hide Post
Jim

Change the heading section to -

HEADING<br />" KPI Comparison Report "<br />" <CDATE - &thrud " 
That will use the field value that you want.

Incidently, the reason you can not use a field value in an amper variable in this manner is that setting an amper variable is a dialogue manager function and settings are performed outside of the actual TABLE request.

As has been mentioned, you can table the file and save the output the read the value in.

Using the actual data value as suggested above is the way to go.
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Jim,

In this case, you can calculate variable values before request, &THRUD and &CDATE would be constants, not data depending fields. After, you can use these variables anywhere. Try the following example:


-* Variables definition.
-DEFAULT &THRUD1 = 200406 ;
-SET &CDATE1 = AYM(&THRUD1 , -11, 'I6') ;
-SET &THRUD2 = EDIT(&THRUD1, '9999-99') ;
-SET &CDATE2 = EDIT(&CDATE1, '9999-99') ;

-* Test variables:
-TYPE THRUD1 - &THRUD1
-TYPE CDATE1 - &CDATE1
-TYPE THRUD2 - &THRUD2
-TYPE CDATE2 - &CDATE2

-* Fields definition.
DEFINE FILE LOG_KPI_SMRY ADD
DEFCNT/I6 WITH JOB_OID = IF JOB_OID IS MISSING THEN 0 ELSE 1;
SUB_PSL_NM/A64 WITH SUB_PSL_NM = 'Global';
END

-* Report.
TABLE FILE LOG_KPI_SMRY
HEADING
"KPI Comparison Report "
"From &CDATE2 to &THRUD2 "
" "
SUM
SUB_PSL_NM NOPRINT OVER
DEFCNT AS 'Number of Jobs' OVER
LT_JOB_FLG AS 'Number of Lost Time Jobs' OVER
TOT_NBR_SRVC AS 'Number of Services' OVER
....
ACROSS SUB_PSL_NM AS 'From &CDATE2 to &THRUD2'

WHERE JOB_YR_MO GE '&CDATE1' ;
WHERE JOB_YR_MO LE '&THRUD1' ;
...
END

I hope this helps. Regards,
Mikel

This message has been edited. Last edited by: <Mabel>,
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
<Jim Rich>
posted
quote:
Originally posted by Tony Alsford:
[qb] Jim

Change the heading section to -

HEADING<br />" KPI Comparison Report "<br />" <CDATE - &thrud " 
That will use the field value that you want.

Incidently, the reason you can not use a field value in an amper variable in this manner is that setting an amper variable is a dialogue manager function and settings are performed outside of the actual TABLE request.

As has been mentioned, you can table the file and save the output the read the value in.

Using the actual data value as suggested above is the way to go. [/qb]
----
I tried using
 
Report This Post
<Jim Rich>
posted
quote:
Originally posted by Jim Rich:
[qb]
quote:
Originally posted by Tony Alsford:
[qb] Jim

Change the heading section to -

HEADING<br />" KPI Comparison Report "<br />" <CDATE - &thrud " 
That will use the field value that you want.

Incidently, the reason you can not use a field value in an amper variable in this manner is that setting an amper variable is a dialogue manager function and settings are performed outside of the actual TABLE request.

As has been mentioned, you can table the file and save the output the read the value in.

Using the actual data value as suggested above is the way to go. [/qb]
----
I tried using
Didn't stick. I tried using <CDATE but then the header line did not show at all.
 
Report This Post
<Jim Rich>
posted
quote:
Originally posted by susannah:
[qb] take the ' away from your &var;
TD/YYM- = '&thrud';
should be
TD/YYM = &thrud ;
also, that dash - after the format YYM-
is goofy; whats up with that?
In your code below, you want to read out to an &var.
you have 2 choices;
1) do all the date calcs in dialog manager. (best way)
2) after the defines,write the CDATE out to a file, then READ the file with a -READ , setting your new &var. [/qb]
----
also, that dash - after the format YYM-
is goofy; whats up with that?
The dash - after YYM is the coding for using a dash in the output format. 4 digit year-2 digit month i.e. 2004-06 rather than yym which gives 2004/06
 
Report This Post
Expert
posted Hide Post
oh! isn't that interesting. Cool to know.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report 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     Can I assign a field name to an &amp;var?

Copyright © 1996-2020 Information Builders