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     [CLOSED] Dynamic variable assignment

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Dynamic variable assignment
 Login/Join
 
Member
posted
Hi,
I need to assign variables dynamically as below. I will get the variable Name and Variable value in 2 different parameters and need to assign the value accordingly.

Code
========

-SET &VAR_NAME ='Fruit';
-SET &VAR_VALUE ='Apple';
-TYPE &Fruit

Expected Output
================
Apple

Please let me know how to achieve it.

Thanks

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8

Windows, All Outputs
 
Posts: 16 | Registered: March 28, 2018Report This Post
Guru
posted Hide Post
quote:
-SET &VAR_NAME ='Fruit';
-SET &VAR_VALUE ='Apple';
-TYPE &Fruit


NOTE: Turn off prompting on your procedure and you will not need the DEFAULTH command.

 -DEFAULTH &Fruit = '_FOC_NULL'
-SET &VAR_NAME ='Fruit';
-SET &VAR_VALUE ='Apple';
-SET &VAR_NAME.EVAL = &VAR_VALUE;
-TYPE &Fruit 


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Virtuoso
posted Hide Post
-SET &VAR_NAME = 'Fruit';
-SET &VAR_VALUE_.&VAR_NAME = 'Apple';
-TYPE &VAR_VALUE_Fruit


Autoprompt will want to know about &VAR_VALUE_Fruit though...


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
quote:
Originally posted by Don Garland:
quote:
-SET &VAR_NAME ='Fruit';
-SET &VAR_VALUE ='Apple';
-TYPE &Fruit


NOTE: Turn off prompting on your procedure and you will not need the DEFAULTH command.

 -DEFAULTH &Fruit = '_FOC_NULL'
-SET &VAR_NAME ='Fruit';
-SET &VAR_VALUE ='Apple';
-SET &VAR_NAME.EVAL = &VAR_VALUE;
-TYPE &Fruit 


Hi Don ,
I duno the parameter name at all since thats dynamic then how do I set the below
-DEFAULTH &Fruit = '_FOC_NULL'


WebFOCUS 8

Windows, All Outputs
 
Posts: 16 | Registered: March 28, 2018Report This Post
Virtuoso
posted Hide Post
SridharLakshmipathy

It is confusing as to where this parameter name is being set dynamically. Is it in a html form or where does this happen. Parameter names should not be set dynamically, the values they contain can be but not the actual parameter name itself.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Member
posted Hide Post
quote:
Originally posted by FP Mod Chuck:
SridharLakshmipathy

It is confusing as to where this parameter name is being set dynamically. Is it in a html form or where does this happen. Parameter names should not be set dynamically, the values they contain can be but not the actual parameter name itself.


FP Mod Chuck,
If you look at my example , you can see &VAR_NAME ='Fruit' i.e. the parameter name is Fruit which will come in VAR_NAME variable.


WebFOCUS 8

Windows, All Outputs
 
Posts: 16 | Registered: March 28, 2018Report This Post
Master
posted Hide Post
Hi,

or this:
-SET &ECHO = ALL;

-SET &VAR_NAME = 'fruit'; 
-SET &VAR_VALUE_.&VAR_NAME = 'apple'; 

-TYPE &VAR_VALUE_fruit


but here also. You need to turn of auto-prompt.

The real question is : Why do you need this? It will be almost impossible to write code for variables with variable names.

What are you trying to achieve?


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Member
posted Hide Post
quote:
Originally posted by Dave:
Hi,

or this:
-SET &ECHO = ALL;

-SET &VAR_NAME = 'fruit'; 
-SET &VAR_VALUE_.&VAR_NAME = 'apple'; 

-TYPE &VAR_VALUE_fruit


but here also. You need to turn of auto-prompt.

The real question is : Why do you need this? It will be almost impossible to write code for variables with variable names.

What are you trying to achieve?


Hi Dave,
Thank you, but I need to do without auto prompting.
Below is the example of what I want to achieve. I will get the dynamic request parameters from java like below. so I need to read variable values from the request params only.

1) /ibi_apps/WFservlet?IBIF_ex=general&IBIAPP_app=baseapp&VAR_NAME=Fruit&VAR_VALUE=Apple&Application=1

2) /ibi_apps/WFservlet?IBIF_ex=general&IBIAPP_app=baseapp&VAR_NAME=Animal&VAR_VALUE=Tiger&Application=2

3) /ibi_apps/WFservlet?IBIF_ex=general&IBIAPP_app=baseapp&VAR_NAME=Bird&VAR_VALUE=pigeon&Application=3


general.fex
################
-IF &Application EQ '1' THEN APP1 ELSE APP2;
-APP1
-INCLUDE APP1
-GOTO ENDAPP
-APP2
-IF &Application EQ '3' THEN APP3;
-INCLUDE APP2
-GOTO ENDAPP
-APP3
-INCLUDE APP3
-ENDAPP

APP1.fex
##########
-TYPE &Fruit

APP2.fex
##########
-TYPE &Animal

APP3.fex
##########
-TYPE &Bird

Thanks


WebFOCUS 8

Windows, All Outputs
 
Posts: 16 | Registered: March 28, 2018Report This Post
Virtuoso
posted Hide Post
As far as I can see you don't need different variable's name.

Each Appx.fex can use the same variable's name, only the assigned value is important.
It doesn't matter that a variable named &MY_VAR contains either a fruit's name, an animal's name or a bird's name. You're making your request too complicated for nothing.
If you need to know the content "type" then have one variable to receive the type (VAR_TYPE : fruit, animal, bird) and one for the kind (VAR_VALUE : apple, tiger, pigeon).


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Guru
posted Hide Post
It looks like you need to determine the "category" of &VAR_NAME before you launch a procedure? Why is that? Not knowing why you want to do this, but here is what I would to with your traffic control logic.

general.fex
################

-GOTO &VAR_NAME


-APP1
-INCLUDE APP1
-GOTO ENDAPP

-APP2
-INCLUDE APP2
-GOTO ENDAPP

-APP3
-INCLUDE APP3

-ENDAPP


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Member
posted Hide Post
quote:
Originally posted by MartinY:
As far as I can see you don't need different variable's name.

Each Appx.fex can use the same variable's name, only the assigned value is important.
It doesn't matter that a variable named &MY_VAR contains either a fruit's name, an animal's name or a bird's name. You're making your request too complicated for nothing.
If you need to know the content "type" then have one variable to receive the type (VAR_TYPE : fruit, animal, bird) and one for the kind (VAR_VALUE : apple, tiger, pigeon).


Hi Martin,
I agree but the APP1, APP2 and APP3 applications already built and we have more than 1000 lines of code. I dont want to revisit the 1000 lines of code again to have unique variable name..

Thanks,


WebFOCUS 8

Windows, All Outputs
 
Posts: 16 | Registered: March 28, 2018Report This Post
Member
posted Hide Post
quote:
Originally posted by Don Garland:
It looks like you need to determine the "category" of &VAR_NAME before you launch a procedure? Why is that? Not knowing why you want to do this, but here is what I would to with your traffic control logic.

general.fex
################

-GOTO &VAR_NAME


-APP1
-INCLUDE APP1
-GOTO ENDAPP

-APP2
-INCLUDE APP2
-GOTO ENDAPP

-APP3
-INCLUDE APP3

-ENDAPP


Hi Don,
We are not only routing the fex traffic based on the category, we need to assign the variable values dynamically


WebFOCUS 8

Windows, All Outputs
 
Posts: 16 | Registered: March 28, 2018Report This Post
Platinum Member
posted Hide Post
Maybe this will work for you. I tested the following code in WebFOCUS 8.2.x

-DEFAULTH &VAR_NAME  = 'Fruit';
-DEFAULTH &VAR_VALUE = 'Apple';

-SET &.&VAR_NAME = &VAR_VALUE;

-? &Fruit

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


WebFOCUS 8.2.06
 
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010Report This Post
Guru
posted Hide Post
quote:
Hi Don,
We are not only routing the fex traffic based on the category, we need to assign the variable values dynamically


Right, but isn't it true, that once you've determined the category (app name) then you know what variable names must exist to make that work?


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Member
posted Hide Post
quote:
Originally posted by Don Garland:
quote:
Hi Don,
We are not only routing the fex traffic based on the category, we need to assign the variable values dynamically


Right, but isn't it true, that once you've determined the category (app name) then you know what variable names must exist to make that work?


Hi Don,
Yes, we shall be able to identify the category and list of variables used in it . if so we need use -SET DEFAULTH for all variables used in all apps .


WebFOCUS 8

Windows, All Outputs
 
Posts: 16 | Registered: March 28, 2018Report This Post
Guru
posted Hide Post
quote:
-SET DEFAULTH for all variables used in all apps .



There are couple of ways to approach the DEFAULT(H) issue.

1. Right click on the procedures and set the Prompt for Parameters to 'NO'.

2. If you need default values for your parameters, then create an include file that has all of the variable names and their defaults and add that to the top of your procedures. You can set defaults for all the variables you want, even if you don't use them and it's a great way to keep track of all the variables that you create.


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Virtuoso
posted Hide Post
In each APPx.fex you can add the following.
So you keep the var's name as they are in each fex but with no need to have dynamic var name assignation

-* APP1.fex
-SET &Fruit = &VAR_VALUE;
-TYPE &Fruit

-* APP2.fex
-SET &Animal = &VAR_VALUE;
-TYPE &Animal

-* APP3.fex
-SET &Bird = &VAR_VALUE;
-TYPE &Bird


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report 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     [CLOSED] Dynamic variable assignment

Copyright © 1996-2020 Information Builders