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] Force SQL UPDATE statement before refreshing data.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Force SQL UPDATE statement before refreshing data.
 Login/Join
 
Gold member
posted
I am having a problem with the following procedure.
What I am trying to do is select records based on an order number and update the order status via SQL UPDATE command. After running the SQL UPDATE which is triggered from a menu drill I am trying to re-display the data with the updated status. The problem I am having is that after the SQL UPDATE I am trying to refresh my HTML table based on the updated data. It appears that the HTML table is based on data before the update. If I close and re-run the procedure then I receive the expected results in the updated table.

Is there a way to force the SQL UPDATE to run before re-selecting the data?

-* report rpt_sql_testing.fex
-DEFAULT &ORDERNO = 1054727;
-DEFAULTH &CONFIRM = 'NO';
-DEFAULTH &STATUS = 28;
-SET &RANDOM = RDUNIF('D12.9') * 1000000;

-IF &CONFIRM EQ 'YES' GOTO UPDATE
- ELSE GOTO SELECT;

-SELECT
ENGINE SQLPSTGR SET DEFAULT_CONNECTION DBTEST
SQL SQLPSTGR PREPARE SQLOUT FOR
SELECT ORDERNO1,PDATE,STOCKID,PARTCODE,SUBADMINID,STATUS FROM TEST.PACKING2 WHERE ORDERNO1 = &ORDERNO;
END

TABLE FILE SQLOUT
PRINT
  orderno1 AS ORDERNO1
  pdate AS PDATE
  stockid AS STOCKID
  partcode AS PARTCODE
  subadminid AS SUBADMINID
  status AS STATUS
ON TABLE HOLD AS HOLDTEMP_SQLOUT FORMAT FOCUS
END

TABLE FILE HOLDTEMP_SQLOUT
PRINT
  ORDERNO1
  PDATE
  STOCKID
  PARTCODE
  SUBADMINID
  STATUS
  COMPUTE CONFIRM_LINK/A100V = 'Click to Update Shipment';
  COMPUTE CONFIRM_VALUE/A3V = 'YES'; NOPRINT
WHERE ORDERNO1 EQ &ORDERNO;
ON TABLE SUBHEAD
""
ON TABLE SET STYLE *
INCLUDE=ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, $
TYPE=DATA,
     COLUMN=N7,
     DRILLMENUITEM='Confirm Shipment',
          FOCEXEC=rpt_sql_testing.fex( \
     ORDERNO=N1 \
     RANDOM=&RANDOM \
	 CONFIRM='YES' \
     ),
     TARGET='_self',
     DRILLMENUITEM='Refresh Data',
          FOCEXEC=rpt_sql_testing.fex( \
     ORDERNO=N1 \
     RANDOM=&RANDOM \
	 CONFIRM='NO' \
     ),
     TARGET='_self',
$
ENDSTYLE
END
-GOTO EXIT

-UPDATE
ENGINE SQLPSTGR SET DEFAULT_CONNECTION DBTEST_WRITE
SQL SQLPSTGR
UPDATE TEST.PACKING2 SET STATUS = 75 WHERE ORDERNO1 = &ORDERNO AND STATUS = 28;
-*UPDATE TEST.PACKING2 SET STATUS = 28 WHERE ORDERNO1 = &ORDERNO AND STATUS = 75;
SQL COMMIT;
END

-RUN
SLEEP 3

-GOTO SELECT

-EXIT

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


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Report This Post
Virtuoso
posted Hide Post
It may be your commit. Maybe it should be coded SQL SQLPSTGR COMMIT;


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
Gold member
posted Hide Post
Or maybe this (which is essentially the same as what Chuck just suggested):

ENGINE SQLPSTGR COMMIT WORK;
END
-RUN

I found that in this SPS (Symptom/Problem/Solution) that sounded similar in 8009.

Deferred request with SQL passthru fails with COMMIT, but runs when not deferred
https://techsupport.informatio...m/sps/160502041.html

Hope that helps!
Toby
 
Posts: 62 | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
quote:
SQL SQLPSTGR COMMIT;

Thanks for the suggestion but still no change in behavior.

The code is behaving like it is running all the select statements first then running the update last. I can tell the "SLEEP 3" is pausing before receiving the final TABLE FILE PRINT results however it appears that the data is based on the select prior to committing the update.


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Report This Post
Virtuoso
posted Hide Post
I understand that it will create duplicate code but can you try using the following
Forcing to have a new hold set of data may result the issue. Pay attention that I use another hold file name : HOLDTEMP_SQLOUT2
-* report rpt_sql_testing.fex
-DEFAULT &ORDERNO = 1054727;
-DEFAULTH &CONFIRM = 'NO';
-DEFAULTH &STATUS = 28;
-SET &RANDOM = RDUNIF('D12.9') * 1000000;

-IF &CONFIRM EQ 'YES' GOTO UPDATE
- ELSE GOTO SELECT;

-SELECT
ENGINE SQLPSTGR SET DEFAULT_CONNECTION DBTEST
SQL SQLPSTGR PREPARE SQLOUT FOR
SELECT ORDERNO1,PDATE,STOCKID,PARTCODE,SUBADMINID,STATUS FROM TEST.PACKING2 WHERE ORDERNO1 = &ORDERNO;
END

TABLE FILE SQLOUT
PRINT
  orderno1 AS ORDERNO1
  pdate AS PDATE
  stockid AS STOCKID
  partcode AS PARTCODE
  subadminid AS SUBADMINID
  status AS STATUS
ON TABLE HOLD AS HOLDTEMP_SQLOUT FORMAT FOCUS
END

TABLE FILE HOLDTEMP_SQLOUT
PRINT
  ORDERNO1
  PDATE
  STOCKID
  PARTCODE
  SUBADMINID
  STATUS
  COMPUTE CONFIRM_LINK/A100V = 'Click to Update Shipment';
  COMPUTE CONFIRM_VALUE/A3V = 'YES'; NOPRINT
WHERE ORDERNO1 EQ &ORDERNO;
ON TABLE SUBHEAD
""
ON TABLE SET STYLE *
INCLUDE=ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, $
TYPE=DATA,
     COLUMN=N7,
     DRILLMENUITEM='Confirm Shipment',
          FOCEXEC=rpt_sql_testing.fex( \
     ORDERNO=N1 \
     RANDOM=&RANDOM \
	 CONFIRM='YES' \
     ),
     TARGET='_self',
     DRILLMENUITEM='Refresh Data',
          FOCEXEC=rpt_sql_testing.fex( \
     ORDERNO=N1 \
     RANDOM=&RANDOM \
	 CONFIRM='NO' \
     ),
     TARGET='_self',
$
ENDSTYLE
END
-GOTO EXIT

-UPDATE
ENGINE SQLPSTGR SET DEFAULT_CONNECTION DBTEST_WRITE
SQL SQLPSTGR
UPDATE TEST.PACKING2 SET STATUS = 75 WHERE ORDERNO1 = &ORDERNO AND STATUS = 28;
-*UPDATE TEST.PACKING2 SET STATUS = 28 WHERE ORDERNO1 = &ORDERNO AND STATUS = 75;
SQL COMMIT;
END

-RUN
SLEEP 3

ENGINE SQLPSTGR SET DEFAULT_CONNECTION DBTEST
SQL SQLPSTGR PREPARE SQLOUT FOR
SELECT ORDERNO1,PDATE,STOCKID,PARTCODE,SUBADMINID,STATUS FROM TEST.PACKING2 WHERE ORDERNO1 = &ORDERNO;
END

TABLE FILE SQLOUT
PRINT
  orderno1 AS ORDERNO1
  pdate AS PDATE
  stockid AS STOCKID
  partcode AS PARTCODE
  subadminid AS SUBADMINID
  status AS STATUS
ON TABLE HOLD AS HOLDTEMP_SQLOUT2 FORMAT FOCUS
END

TABLE FILE HOLDTEMP_SQLOUT2
PRINT
  ORDERNO1
  PDATE
  STOCKID
  PARTCODE
  SUBADMINID
  STATUS
  COMPUTE CONFIRM_LINK/A100V = 'Click to Update Shipment';
  COMPUTE CONFIRM_VALUE/A3V = 'YES'; NOPRINT
WHERE ORDERNO1 EQ &ORDERNO;
ON TABLE SUBHEAD
""
ON TABLE SET STYLE *
INCLUDE=ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, $
TYPE=DATA,
     COLUMN=N7,
     DRILLMENUITEM='Confirm Shipment',
          FOCEXEC=rpt_sql_testing.fex( \
     ORDERNO=N1 \
     RANDOM=&RANDOM \
	 CONFIRM='YES' \
     ),
     TARGET='_self',
     DRILLMENUITEM='Refresh Data',
          FOCEXEC=rpt_sql_testing.fex( \
     ORDERNO=N1 \
     RANDOM=&RANDOM \
	 CONFIRM='NO' \
     ),
     TARGET='_self',
$
ENDSTYLE
END

-EXIT


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] Force SQL UPDATE statement before refreshing data.

Copyright © 1996-2020 Information Builders