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     Need to run a query n times with n different values

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Need to run a query n times with n different values
 Login/Join
 
Member
posted
from an fex we have some values which are retrieved from a table (please note
that the count of records will not be the same). by clicking a button we need to
insert the data into the respective table. we need to find a logic in which we
can use the same query passed with different values to insert into the table.
 
Posts: 23 | Registered: April 20, 2007Report This Post
Platinum Member
posted Hide Post
Not sure what kind of table you are rying ot pass these values into, but -write might be the solution you seek to write it out, while the
-read would be the mechanism to read from the source. you can control this by clicking on a button to invoke the -read.

Hope this helps.
 
Posts: 195 | Registered: October 27, 2006Report This Post
Platinum Member
posted Hide Post
Did you try putting the query in a loop using -REPEAT ? If I understand you correctly, we also have apps that re-run the same query again and again with changing values in the WHERE statemenent. The input can be static or dynamic (like getting input from another file).
Here is a high level code sample where the input comes from a Hold file :

-SET &HCNT=0;
-READ HOLDFL1 &INVAR.A10
-*
-REPEAT LBL_LOOP1 WHILE &IORETURN EQ 0;
-SET &HCNT=&HCNT + 1;
-*
SQL DB2
SELECT FLD1,FLD2 FROM DB1.TBL1
WHERE FLDX='&INVAR.EVAL'
;
TABLE
ON TABLE HOLD AS HSQL&HCNT..F
END
-*
-READ HOLDFL1 &INVAR.A10
-LBL_LOOP1
-*
(you will then end up with &HCNT value number of Hold files to concatenate and process further).
-*
Hope that example helps you understand the principle behind the process. Your query could be an INSERT or UPDATE query as applicable.

Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
<Tim Howard_ABCBS>
posted
Here's some logic I've used to read from a table and then loop through the values. I'm not sure either about what type of table you need to insert into, but if you mean insert into a database table, I would look at maybe creating a stored procedure to insert the value with the value as the parm to insert. You can then invoke the stored procedure from WF as you loop through your results from the table. Here's the code:

TABLE FILE table_name
WRITE some_field
WHERE ....
ON TABLE HOLD AS HLDVALS
END

-*This returns the number of records retrieved
-*so you'll know how many times to loop on the read.
-SET &RECCNT = &LINES;

-REPEAT READLOOP &RECCNT TIMES
-READ HLDVALS &NEWVAL.A10.
-*You can use whatever logic you need here, such as
-*call a stored procedure, create define or table
-*logic, etc...I'm using stored procedure here for this example.
SQL SQLMSS SET SERVER reportcaster
SQL SQLMSS EX sp_name '&NEWVAL'
END
-YEARS
-READLOOP



I'm using a sql server stored procedure in my example, the syntax may be different depending on you platform.

I'm not sure if this is what you are looking for, just thought I'd share something I've done in the past.
 
Report This Post
Member
posted Hide Post
thanks all for your reply. i am working on to achive this using JSP
 
Posts: 23 | Registered: April 20, 2007Report 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     Need to run a query n times with n different values

Copyright © 1996-2020 Information Builders