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     how to update multiple

Read-Only Read-Only Topic
Go
Search
Notify
Tools
how to update multiple
 Login/Join
 
Guru
posted
Hello,

I have a hold file looks like the following

COUNTER USER
1 AAUL
2 ABZADBXP
3 ABZADSCS
4 ABZAEDGR
5 ABZAEGXA
6 ABZIMMXP
7 ABZIMTXH
8 ABZOPCYM
9 ABZOPGXM
10 ABZOPRXJ

After I do the hold, I want to update a table where a field = '&USER'

This is what I came up with so far

TABLE FILE
...
ON TABLE HOLD AS USER
END



ENGINE SQLORA SET DEFAULT_CONNECTION MYTABLE
SQL SQLORA PREPARE SQLOUT FOR
update myuser
set role = 'Analyst'
where userid = '&USER';
END


I am having problem with the looping part. How would I update the TABLE for all values matching USER?

Thanks,
Sayed


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
 
Posts: 285 | Location: Texas | Registered: June 27, 2006Report This Post
Expert
posted Hide Post
Sayed,

Do you know Dialog Manager? Once you create your hold or save file, you can use DM to -READ the user values one at a time and concatenate them into a string that has ORs between them can you can substitute into your SQL. That is assuming all the users will be 'Analyst'.

Please read up on -READ, -SET, and -REPEAT. I could give you the code, but that would be cheating. Smiler

But really, if you can't figure it out, let me know and I'll put something together tomorrow.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Master
posted Hide Post
Here's a piece of code that might help. This is doing an insert, but you can use the same technique to UPDATE and DELETE.
 TABLEF FILE CLINTINS
  PRINT *
     ON TABLE SET HOLDFORMAT ALPHA
     ON TABLE HOLD
 END
-RUN
-*
-SET &CL_CNT=0;
-CL_LOOP
-*
-READ HOLD NOCLOSE &CLID.8. &GNDR.5. &SSN.9. &DOB.8. &RACE.5. &PTRIBE.5.,
-, &STRIBE.5. &FNM.25. &MNM.25. &LNM.25. &DCN.10. &HISP.1. &CRTDT.17.
-IF &IORETURN NE 0 THEN GOTO CL_END;
-SET &CL_CNT=&CL_CNT+1;
-*
-SET &SSN=IF &SSN EQ . THEN NULL ELSE '''&SSN.EVAL''';
-SET &DOB=IF &DOB EQ . THEN NULL ELSE 'TO_DATE(''&DOB.EVAL'',''YYYYMMDD'')';
-SET &RACE=IF &RACE EQ . THEN NULL ELSE ∽̱
-SET &PTRIBE=IF &PTRIBE EQ . THEN NULL ELSE &PTRIBE;
-SET &STRIBE=IF &STRIBE EQ . THEN NULL ELSE &STRIBE;
-SET &FNM=TRIM('B','&FNM.EVAL',25,' ',1,'A25');
-SET &FNM=IF '&FNM.EVAL' EQ '.' THEN NULL ELSE '''&FNM.EVAL''';
-SET &MNM=TRIM('B','&MNM.EVAL',25,' ',1,'A25');
-SET &MNM=IF '&MNM.EVAL' EQ '.' THEN NULL ELSE '''&MNM.EVAL''';
-SET &LNM=TRIM('B','&LNM.EVAL',25,' ',1,'A25');
-SET &LNM=IF '&LNM.EVAL' EQ '.' THEN NULL ELSE '''&LNM.EVAL''';
-SET &DCN=IF &DCN EQ . THEN NULL ELSE &DCN;
-SET &HISP=IF &HISP EQ . THEN NULL ELSE '''&HISP.EVAL''';
-TYPE &CLID &GNDR &SSN &DOB &RACE &PTRIBE &STRIBE &FNM &MNM &LNM &DCN &HISP
-*
 SET SQLENGINE=SQLORA
 SQL SET PASSRECS OFF
 SQL SET SERVER &&KIDS_SERVER
 SQL INSERT INTO TCLIENT
   (CL_ID,
    GNDR_TYP_CDE,
    CL_SSN_NBR,
    BRTH_DT,
    PRIM_ETHNCTY_TYP,
    PRIM_TRIB_TYP_CDE,
    SEC_TRIB_TYP_CDE,
    FRST_NME,
    MIDD_NME,
    LST_NME,
    DHS_CL_NBR,
    HISPANIC_SW,
    CRMNL_REC_SW,
    NEED_INTRPT_SW,
    US_CTZN_SW,
    SNSTV_INFO_PPR_FIL,
    APPL_FOR_DDSD_CERT,
    CANDT_FOR_DDSD_SW,
    RACE_DTRMN_BY_TYP_CDE,
    INTFC_TYP_CDE,
    CRT_INTFC_TYP_CDE,
    CREATION_DT)
    VALUES(&CLID, &GNDR, &SSN, &DOB, &RACE, &PTRIBE, &STRIBE,
      &FNM, &MNM, &LNM,
      &DCN, &HISP, 'N', 'N', 'N', 'N', 'N', 'N',
      7280, 8435, 8435, SYSDATE);
 SQL &COMMIT ;
 END
-RUN
-GOTO CL_LOOP
-*
-CL_END


You don't need the &CL_CNT, unless you want to verify that you processed the correct number of row. Also, you need the get rid of the trail blanks for varchar fields.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Guru
posted Hide Post
Thanks both of you for responding. I got it to work with code below.

  
-* File user.fex
DEFINE FILE USER
USERID/A20=LOCASE(20, USER.USER.FIELD_4, USERID);
END
TABLE FILE USER
PRINT
USERID
WHERE USERID NE '';
ON TABLE HOLD AS ANALYTIC
END
TABLE FILE ANALYTIC

PRINT

     'ANALYTIC.ANALYTIC.USERID'
BY 'ANALYTIC.ANALYTIC.USERID' NOPRINT
ON TABLE NOTOTAL
ON TABLE HOLD AS ANALYTIC2
END




-SET &A = 1;
ENGINE SQLORA SET DEFAULT_CONNECTION WFREALM



-RUN
-REPEAT LABEL WHILE &A LE 2034;
-SET &A = &A + 1;
-READ ANALYTIC2 &MYUSERID.A20
-TYPE In the Start Sql Report Include: &MYUSERID

SQL ORA
update wf_mrusers
set roleid = 'AnalyticalUser'
where userid = ltrim(rtrim('&MYUSERID'));
END
SQL ORA
COMMIT ;
END
-TYPE In the Stop Sql Report Include: &MYUSERID
-LABEL TYPE END: &A
-RUN



WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
 
Posts: 285 | Location: Texas | Registered: June 27, 2006Report 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     how to update multiple

Copyright © 1996-2020 Information Builders