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     Save User Input data to a text file using javascript

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Save User Input data to a text file using javascript
 Login/Join
 
Platinum Member
posted
We are developing a report to allow the users to enter and update new data to the Sql Server database. We need to update 12 months of data for multiple parts by customer for e.g. :-

Customer 1 -- Update Button (to update all parts information for Customer 1)

Part 1
12 10 13 14 15 10 5 10 20 30 0 10

Part 2
5 10 20 20 10 0 10 100 50 20 10 40

Part 3
15 80 100 30 10 0 60 30 70 30 90 10

Customer 2 -- Update Button (to update all parts information for Customer 2)

Part 1
102 100 113 140 150 10 5 10 20 30 0 10

Part 2
50 110 210 250 100 0 10 100 50 20 10 40

The approach we are trying to use is to read all the data using javascript and save it to a text file and then read from the text file to update to the database.

Any input would be very helpful.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
Expert
posted Hide Post
Why not just use AJAX techniques to write direct to the database?

If you don't know AJAX methods then, of course, this won't help you Frowner

Do you know ASP? You could use that instead.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Check out this link as it may give you what you need.

Remember that the search function (top right) is always available to search the forum and tech support (if you have access).

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Yes, we do have AJAX and ASP knowledge but can you show a sample of how mw may embed ASP or AJAX code inside of the webFOCUS languange.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
<JG>
posted
If an excel spread sheet based solution would be of any use look at this old WebFOCUS news letter article.

Excelling With WebFOCUS: Updating Server Data from a WebFOCUS Excel Template

As an alternative the following is a replacement for the old FOCUS AUTOMOD facility
for use on single segment tables (FOCUS or SQL) allowing insert, update and delete.

Still needs a little bit of work for some formats but generally works fine.

 
-DEFAULTS &ENTRYPOINT='START'
-DEFAULTS &FOCDB='GGORDER'
SET MSG=ON
SET EMPTYREPORT=ON
-GOTO &ENTRYPOINT
-START
-HTMLFORM BEGIN
<HTML>
<FORM name="DB" method="post" action="/ibi_apps/WFServlet">
<INPUT type="hidden" name="IBIF_ex" value="automod">
<INPUT type="hidden" name="ENTRYPOINT" value="GETKEY">
<a>Enter the name of the table you wish to use</a><BR>
<INPUT TYPE="TEXT" NAME="FOCDB" VALUE=" ">
<INPUT TYPE="SUBMIT" NAME="Select" VALUE="Select">
</FORM>
</HTML>
-HTMLFORM END
-EXIT
-GETKEY
CHECK FILE &FOCDB HOLD
-RUN
TABLE FILE HOLD
"Please  enter the key for the record you want"
PRINT FIELDNAME AS ''
COMPUTE KEYFLD/A200=
'<INPUT TYPE="TEXT" SIZE="55" NAME=ROWID MAXLENGTH="256" VALUE=" ">'; AS ''
WHERE FLDNO EQ 1
ON TABLE SET PAGE NOLEAD
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS ROWSEL FORMAT HTMTABLE
END
-RUN
-HTMLFORM BEGIN
<HTML>
<FORM name="DB" method="post" action="/ibi_apps/WFServlet">
<INPUT type="hidden" name="IBIF_ex" value="automod">
<INPUT type="hidden" name="ENTRYPOINT" value="GETROW">
<INPUT TYPE="HIDDEN" NAME="FOCDB" VALUE="!IBI.AMP.FOCDB;">
!IBI.FIL.ROWSEL;
<INPUT TYPE="SUBMIT" NAME="Select" VALUE="Select">
</FORM>
</HTML>
-HTMLFORM END
-EXIT
-GETROW
CHECK FILE &FOCDB HOLD
-RUN
TABLE FILE HOLD
SUM COMPUTE COLNO/I5= MAX.FLDNO -1;
PRINT
    FIELDNAME FORMAT EXLEN
BY FLDNO    NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
 
ON TABLE HOLD AS ALLCOLS FORMAT ALPHA
END
-RUN
-SET &NOCOLS=&LINES;
-SET &CNTR=0;
-REPEAT COLVAR &NOCOLS TIMES
-SET &CNTR=&CNTR +1;
-READ ALLCOLS &COLS.A5. &FLD&CNTR.EVAL.A66. &FMT&CNTR.EVAL.A8. &FLDLEN&CNTR.EVAL.A4.
-COLVAR
-*
TABLE FILE &FOCDB
PRINT *
IF &FLD1.EVAL EQ &ROWID
WHERE RECORDLIMIT EQ 1
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS ROW FORMAT ALPHA
END
-RUN
-SET &ROWLINES = &LINES;
-SET &ALLCOLS= &COLS + 1;
-IF &ROWLINES GT 0 GOTO HAVEROW;
DEFINE FILE &FOCDB
DUMMY/A1=' ';
INSERT/A200=  '<INPUT TYPE="SUBMIT" NAME="INSERT" VALUE="INSERT">';
CANCEL/A200=  '<INPUT TYPE="BUTTON" NAME="Cancel" VALUE="Cancel"  onClick="javascript:history.back();">';
END
TABLE FILE &FOCDB
PRINT &FLD1.EVAL NOPRINT
 
-SET &FLDLEN=&FLDLEN1.EVAL * 1.5;
COMPUTE KEYFLD/A500='<INPUT TYPE="TEXT" SIZE="&FLDLEN.EVAL" NAME="FLD1" VALUE="&ROWID"> (&FMT1.EVAL)'; 
                    AS '&FLD1.EVAL' OVER
-SET &CNTR=2;
-REPEAT ENDREPEAT1 &COLS TIMES
-SET &FLDLEN=&FLDLEN&CNTR.EVAL * 1.5;
COMPUTE KEYFLD/A500='<INPUT TYPE="TEXT" SIZE="&FLDLEN.EVAL" NAME="FLD&CNTR.EVAL" VALUE=" "> (&FMT&CNTR.EVAL)'; 
                    AS '&FLD&CNTR.EVAL' OVER
 
-SET &CNTR=&CNTR+1;
-ENDREPEAT1
DUMMY AS ''
ON TABLE SUBFOOT
"<INSERT <CANCEL "
WHERE RECORDLIMIT EQ 1
ON TABLE SET PAGE NOLEAD
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS INSERT FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF,$
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<HTML>
<HEAD>
</HEAD>
<FORM name="automod" method="post" action="/ibi_apps/WFServlet">
<INPUT type="hidden" name="IBIF_ex" value="automod">
<INPUT type="hidden" name="ENTRYPOINT" value="INSERT">
<INPUT type="hidden" name="FOCDB" value="!IBI.AMP.FOCDB;">
<INPUT type="hidden" name="ALLCOLS" value="!IBI.AMP.ALLCOLS;">
!IBI.FIL.INSERT;
</FORM>
</HTML>
-HTMLFORM END
-EXIT
-HAVEROW
DEFINE FILE ROW
DUMMY/A1=' ';
UPDATE/A200=  '<INPUT TYPE="SUBMIT" NAME="Update" VALUE="Update" onClick="return updateRow();">';
DELETE/A200=  '<INPUT TYPE="BUTTON" NAME="Delete" VALUE="Delete" onClick="return deleteRow();">';
CANCEL/A200=  '<INPUT TYPE="BUTTON" NAME="Cancel" VALUE="Cancel"  onClick="javascript:history.back();">';
END
TABLE FILE ROW
PRINT
-SET &FLD1a= IF EDIT(&FMT1,'9') EQ 'A' THEN &FLD1.EVAL ELSE 'EDIT(&FLD1.EVAL)';
COMPUTE KEYFIELD/A500 = IF &ROWLINES EQ 0 THEN  
                        '<INPUT TYPE="TEXT" NAME="FLD1" SIZE="&FLDLEN1.EVAL" VALUE="&FLD1a.EVAL"> (&FMT1.EVAL)' ELSE
                           &FLD1a.EVAL; AS '&FLD1.EVAL'
 
COMPUTE ROWKEY/A500 = '<INPUT TYPE="HIDDEN" NAME="ROWKEY" SIZE="&FLDLEN1.EVAL" VALUE="' || &FLD1a.EVAL || '">' ; AS ''
 
         OVER
-SET &CNTR=2;
-REPEAT ENDREPEAT1 &COLS TIMES
-SET &COLTYPE=EDIT(&FMT&CNTR.EVAL,'9');
-SET &FLDLEN=&FLDLEN&CNTR.EVAL * 1.5;
-SET &DFMT=IF '&COLTYPE.EVAL' EQ 'D' THEN TRUNCATE(&FMT&CNTR.EVAL) ELSE IF '&COLTYPE.EVAL' EQ 'I' THEN 'F9' ELSE 'D12.2';
-SET &PFMT=IF '&COLTYPE.EVAL' EQ 'P' THEN TRUNCATE(&FMT&CNTR.EVAL) ELSE 'P11';
-SET &DCOL=IF '&COLTYPE.EVAL' EQ 'D' OR 'I' THEN TRUNCATE(&FLD&CNTR.EVAL) ELSE 1.1;
-SET &USECOL= IF '&COLTYPE.EVAL' EQ 'A' THEN &FLD&CNTR.EVAL ELSE
-             IF '&COLTYPE.EVAL' EQ 'P' THEN 'PTOA(&DCOL.EVAL,' || '''' || '(&PFMT.EVAL)' || '''' || ',' || '''' 
- || 'A15' || '''' || ')' ELSE
-             IF '&COLTYPE.EVAL' EQ 'D' OR 'F' THEN 'FTOA(&DCOL.EVAL,' || '''' || '(&DFMT.EVALc)' || '''' || ',' 
- || '''' || 'A15' || '''' || ')' ELSE
-             IF '&COLTYPE.EVAL' EQ 'I' THEN 'EDIT(&FLD&CNTR.EVAL)' ELSE
-             IF TRUNCATE(&FMT&CNTR.EVAL) EQ 'DMY' OR 'MDY' OR 'YMD' OR 'DMYY' OR 'MDYY' OR 'YYMD' THEN
-                 'CHGDAT(' || '''' || 'YMD' || '''' ||',' || '''' || '&FMT&CNTR.EVAL' || '''' || ',TEMP_DATE,' 
- || '''' || 'A17' || '''' || ')' ELSE
-               ' ';
-SET &TEMPDATE=IF TRUNCATE(&FMT&CNTR.EVAL) EQ 'DMY' OR 'MDY' OR 'YMD' OR 'DMYY' OR 'MDYY' OR 'YYMD' THEN
-                 'COMPUTE TEMP_DATE/A6YMD = &FLD&CNTR.EVAL; NOPRINT' ELSE ' ';
-*
-* date formats needed
-*
&TEMPDATE.EVAL
COMPUTE COLVAL&CNTR.EVAL/A256= LJUST(&FLDLEN, &USECOL.EVAL , 'A&FLDLEN'); NOPRINT
COMPUTE KEYFLD/A500='<INPUT TYPE="TEXT" SIZE="&FLDLEN.EVAL" NAME="FLD&CNTR.EVAL" VALUE="'|| COLVAL&CNTR.EVAL 
                    ||'"> (&FMT&CNTR.EVAL)'; AS '&FLD&CNTR.EVAL' OVER
 
-SET &CNTR=&CNTR+1;
-ENDREPEAT1
DUMMY AS ''
ON TABLE SUBFOOT
"<UPDATE <DELETE <CANCEL "
ON TABLE SET PAGE NOLEAD
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS UPDATE FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF,$
ENDSTYLE
END
-RUN
-UPDATEROW
-HTMLFORM BEGIN
<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
function deleteRow()
{
var x=window.confirm("are you sure that you wish to delete this row");
 if (x)
 {
     window.document.automod.ENTRYPOINT.value="DELETE";
     window.document.automod.submit();
  }
  else
  {
      return false;
 }
}
</SCRIPT>
<SCRIPT TYPE="text/javascript">
function updateRow()
{
var x=window.confirm("are you sure that you wish to update this row");
 if (x)
 {
     window.document.automod.ENTRYPOINT.value="UPDATE";
     window.document.automod.submit();
  }
  else
  {
      return false;
 }
 }
 </SCRIPT>
</HEAD>
<FORM name="automod" method="post" action="/ibi_apps/WFServlet">
<INPUT type="hidden" name="IBIF_ex" value="automod">
<INPUT type="hidden" name="ENTRYPOINT" value="START">
<INPUT type="hidden" name="FOCDB" value="!IBI.AMP.FOCDB;">
<INPUT type="hidden" name="COLS" value="!IBI.AMP.COLS;">
!IBI.FIL.UPDATE;
</FORM>
</HTML>
-HTMLFORM END
-EXIT
-DELETE
MODIFY FILE &FOCDB
FREEFORM
MATCH * KEYS
ON MATCH DELETE
ON NOMATCH REJECT
DATA
&ROWKEY.EVAL,$
END
-RUN
-HTMLFORM BEGIN
<HTML>
<FORM name="delete" method="post" action="/ibi_apps/WFServlet">
<INPUT type="hidden" name="IBIF_ex" value="automod">
<INPUT type="hidden" name="FOCDB" value="!IBI.AMP.FOCDB;">
<INPUT type="hidden" name="ENTRYPOINT" value="GETKEY">
<a>Row Deleted</a>
<INPUT TYPE="SUBMIT" NAME="Continue" VALUE="Continue">
</FORM>
</HTML>
-HTMLFORM END
-EXIT
-INSERT
-SET &CNTR=1;
-SET &DSTRING= '~';
-REPEAT ENDDATAI &ALLCOLS TIMES
-SET &DSTRING ='&DSTRING.EVAL' || '&FLD&CNTR.EVAL,';
-SET &CNTR=&CNTR+1;
-ENDDATAI
-SET &DSL=&DSTRING.LENGTH -1;
-SET &DATASTRING =STRIP(&DSTRING.LENGTH, '&DSTRING.EVAL', '~', 'A&DSL.EVAL');
-*
MODIFY FILE &FOCDB
FREEFORM
MATCH * KEYS
ON MATCH REJECT
ON NOMATCH INCLUDE
DATA
&DATASTRING.EVAL$
END
-RUN
-SET &MSG=IF &ACCEPTS NE 1 THEN 'Transaction rejected, Please check your data' ELSE 'Row Inserted';
-SET &BACK=IF &ACCEPTS NE 1 THEN '<INPUT TYPE="BUTTON" NAME="Back" VALUE="Back" onClick="javascript:history.back();">' 
-  ELSE ' ';
-HTMLFORM BEGIN
<HTML>
<FORM name="delete" method="post" action="/ibi_apps/WFServlet">
<INPUT type="hidden" name="IBIF_ex" value="automod">
<INPUT type="hidden" name="FOCDB" value="!IBI.AMP.FOCDB;">
<INPUT type="hidden" name="ENTRYPOINT" value="GETKEY">
<a>!IBI.AMP.MSG;</a>
<INPUT TYPE="SUBMIT" NAME="Continue" VALUE="Continue">
!IBI.AMP.BACK;
</FORM>
</HTML>
-HTMLFORM END
-EXIT
-UPDATE
-SET &CNTR=2;
-SET &DSTRING= '&ROWKEY.EVAL,';
-REPEAT ENDDATAI &COLS TIMES
-SET &DSTRING ='&DSTRING.EVAL' || '&FLD&CNTR.EVAL,';
-SET &CNTR=&CNTR+1;
-ENDDATAI
-SET &DSL=&DSTRING.LENGTH -1;
-SET &DATASTRING =STRIP(&DSTRING.LENGTH, '&DSTRING.EVAL', '~', 'A&DSL.EVAL');
-*
MODIFY FILE &FOCDB
FREEFORM
MATCH * KEYS
ON MATCH UPDATE *
ON NOMATCH REJECT
DATA
&DATASTRING.EVAL,$
END
-RUN
-SET &MSG=IF &ACCEPTS NE 1 THEN 'Transaction rejected, Please check your data' ELSE 'Row Updated';
-SET &BACK=IF &ACCEPTS NE 1 THEN '<INPUT TYPE="BUTTON" NAME="Back" VALUE="Back" onClick="javascript:history.back();">' 
- ELSE ' ';
-HTMLFORM BEGIN
<HTML>
<FORM name="delete" method="post" action="/ibi_apps/WFServlet">
<INPUT type="hidden" name="IBIF_ex" value="automod">
<INPUT type="hidden" name="FOCDB" value="!IBI.AMP.FOCDB;">
<INPUT type="hidden" name="ENTRYPOINT" value="GETKEY">
<a>!IBI.AMP.MSG;</a>
<INPUT TYPE="SUBMIT" NAME="Continue" VALUE="Continue">
!IBI.AMP.BACK;
</FORM>
</HTML>
-HTMLFORM END
-EXIT

 
Report This Post
Expert
posted Hide Post
I would have thought that saving the parms would be easy, I have done it many times.

Just submit a form to WF and collect the &VARS.
After that use MODIFY, simple.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
Thanks JG

I'm going to test this...




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 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     Save User Input data to a text file using javascript

Copyright © 1996-2020 Information Builders