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     [SOLVED] Dynamic Text box on HTML form - Webfocus

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Dynamic Text box on HTML form - Webfocus
 Login/Join
 
Member
posted
How do I create a Dynamic Text box on HTML form.

Ex : If my Report gives 2 records like
NSR
RETENTION RATE
then
I am expecting the below output

NSR [textbox]
RETENTION RATE [textbox]

- Where in users can enter thw values on those textboxes.

If there are 4 entries on my report result then
I need 4 textboxex to be prompted.

Please help me.

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


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 28 | Registered: January 20, 2011Report This Post
Expert
posted Hide Post
Adding the text input boxes are not the problem, just check out my reply to the Images on Heading post and extrapolate for an <INPUT type=text /> HTML tag pairing at each ROW where necessary or if you are intending only in the FOOTING then keep the COMPUTEs at TABLE level.

Then decide how you are going to apply that user input.

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
Member
posted Hide Post
Can you please provide me an example code.
Assume that my code like below.

TABLE FILE CAR
BY PROD AS ''
END


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 28 | Registered: January 20, 2011Report This Post
Expert
posted Hide Post
See the link referenced in my previous post.

T
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
<FreSte>
posted
Sanjeev,

Small example code:

 
DEFINE FILE CAR
  INP_TXT/A100 = '<input type="text" name="' | COUNTRY || '">';
END

TABLE FILE CAR
  SUM 
    INP_TXT
  BY COUNTRY
  ON TABLE SET HTMLCSS ON
  ON TABLE SET STYLE *
    TYPE=REPORT, GRID=OFF,$
  ENDSTYLE
END
 
Report This Post
Member
posted Hide Post
Thanks very much.. Its working.

How do I store the values entered into those Text boxes.So that I would likw t ouse them for further calculation.


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 28 | Registered: January 20, 2011Report This Post
<FreSte>
posted
Well, that's almost more of the same; just add the attribute value to the HTML-tag, like:

DEFINE FILE CAR
  INP_TXT/A100 = '<input type="text" value="' | COUNTRY || '" name="' || COUNTRY || '">';
END

TABLE FILE CAR
  SUM
    INP_TXT
  BY COUNTRY
  ON TABLE SET HTMLCSS ON
  ON TABLE SET STYLE *
    TYPE=REPORT, GRID=OFF,$
  ENDSTYLE
END
 
Report This Post
<FreSte>
posted
.. or do you want to use these stored values in another procedure, then you could do something like this:

DEFINE FILE CAR
  CNTR/I2 WITH COUNTRY = LAST CNTR + 1;
  CNTR_A/A2 = EDIT(CNTR);
  INP_TXT/A100 = '<input type="text" value="' || COUNTRY || '" name="fld' || CNTR_A || '">';
END

TABLE FILE CAR
  SUM
    INP_TXT
  BY COUNTRY
  ON TABLE SET HTMLCSS ON
  ON TABLE SET PAGE NOPAGE
  ON TABLE SET STYLE *
    TYPE=REPORT, GRID=OFF,$
  ENDSTYLE
  ON TABLE HOLD AS HLD1 FORMAT HTMTABLE
END
-RUN

-HTMLFORM BEGIN
<html>
<form method="GET" target=_new action="/ibi_apps/WFServlet">
<input type="hidden" name="IBIF_ex" value="somefex">
!IBI.FIL.HLD1;
<input type=submit>
</form>
</html>
-HTMLFORM END


and create a procedure called "somefex" which is in the serverpath, like:

-? &fld

it will show all variables starting with "fld"

-Fred-
 
Report This Post
Member
posted Hide Post
Thanks very much...

I would like to store the values entered in Focus HOLD file not HTML, And I woul use it in Another procedure.

Is it possible?


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 28 | Registered: January 20, 2011Report This Post
<FreSte>
posted
Yes, it is.
The example above is still valid. You need an HTML-form to be able to enter data.
After pressing Submit, these values are being "send" to the reporting-server and you can use them in the procedure "somefex".

Below you'll find a very basic, non-dynamic example, but you'll get the point.

Cheers

-Fred-


-*somefex

-* --- Create MASTER-file ( + FILEDEF)
TABLE FILE SYSTABLE
  PRINT
    COMPUTE FLD1/A20 = '';
  BY NAME NOPRINT
  ON TABLE SET XRETRIEVAL OFF
  ON TABLE HOLD AS HLDTEMP FORMAT ALPHA
  ON TABLE SET HOLDLIST PRINTONLY
END
-RUN

-* --- Write data to HOLD-file
-WRITE HLDTEMP &fld01
-WRITE HLDTEMP &fld02
-WRITE HLDTEMP &fld03
-WRITE HLDTEMP &fld04
-WRITE HLDTEMP &fld05


-*--- Report on it
TABLE FILE HLDTEMP
  PRINT *
END
 
Report This Post
Expert
posted Hide Post
Yes it is.

The basic flow of a launch page, either a dedicated one, ot something returned from WebFOCUS, is to pass variables to a focexec.

WebFOCUS takes objects within the FORM tags and passes them to WebFOCUS when a form is submitted.

The objects will turn up in the WebFOCUS session as amper variables.

If you have a text entry box with the name COUNTRY1, an amper variable of the same name will be available and the contents of the variable will be the same as the text entry box.

At this stage you could use MODIFY to load the data into a FOCUS file.


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
Gold member
posted Hide Post
I am looking for this type help.

Thanks very much.. Its working for my development.

I want to store the values entered into text boxes.Text Boxes name are dynamic.

In the previuos post,FreSte mentioned that values can be stored by below code

-* --- Write data to HOLD-file
-WRITE HLDTEMP &fld01
-WRITE HLDTEMP &fld02
-WRITE HLDTEMP &fld03
-WRITE HLDTEMP &fld04
-WRITE HLDTEMP &fld05


But these are static name of text boxes.

Kindly please help me with some sample code


WebFOCUS 7.6.1
Windows, All Outputs
 
Posts: 50 | Location: Scun-thorpe,UK | Registered: November 14, 2012Report This Post
Gold member
posted Hide Post
I have done this.Smiler

In a hidden fields captured the no of records.

<input type="hidden" name="txtRecordCount" value="&LINES">

Dynamic result code is given below

-SET &RecordCount = &txtRecordCount;
-SET &I=1;
-TYPE "Entered values are given below";
-LOOP
-SET &A=&fld0.&I;
-TYPE &A;
-SET &I=&I+1;
-IF &I EQ &RecordCount GOTO ENDLOOP;
-GOTO LOOP
-ENDLOOP

Happy coding.
Trilochan.

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


WebFOCUS 7.6.1
Windows, All Outputs
 
Posts: 50 | Location: Scun-thorpe,UK | Registered: November 14, 2012Report This Post
Gold member
posted Hide Post
I have found error in this method.

It works upto a limit of records.

If Record count is more than 500,the system throw a error
INSUFFICIENT MEMORY IS AVAILABLE FOR PROGRAM/CACHE .


Please help me.

My Webfocus version is 7.6.1.

Thank you.


WebFOCUS 7.6.1
Windows, All Outputs
 
Posts: 50 | Location: Scun-thorpe,UK | Registered: November 14, 2012Report This Post
Gold member
posted Hide Post
I have solve this problem by implement paging in the FEX file.

Below is my fex code.

 

-SET &&CONNECTION_NAME='CONNECTION NAME OF ORACLE'
-SET &NO_OF_RECORDS=100;
-DEFAULTS &PG=1;
-DEFAULTS &SUBMITTED=0;
-TYPE &SUBMITTED;
-*---Start-Insert Record
-IF &SUBMITTED EQ 1 THEN GOTO INSERT_DATA ELSE GOTO EXIT_INSERT;
-RUN
-INSERT_DATA
-* Start Insert Into Database
-SET &RecordCount = &txtRecordCount;
-SET &PAGE_COUNT=&PAGE_C;
-SET &PAGE_COUNT1= IF &PAGE_COUNT NE 1 THEN &PAGE_COUNT-1 ELSE &PAGE_COUNT;
-SET &I = IF &PAGE_COUNT EQ 1 THEN 1 ELSE &PAGE_COUNT1.EVAL01;
-SET &RecordCount =IF &RecordCount GT 9 THEN &RecordCount ELSE 0|&RecordCount.EVAL;
-SET &RecordCount2=IF &RecordCount EQ 100 THEN &PAGE_C.EVAL00 ELSE &PAGE_COUNT1.EVAL|&RecordCount.EVAL;
-SET &RecordCount1 =  IF &PAGE_COUNT EQ 1 THEN &RecordCount ELSE IF &TOTAL_PG EQ &PAGE_C THEN &RecordCount2 ELSE &PAGE_COUNT.EVAL00;
-TYPE &RecordCount1;
-LOOP
-SET &REMARK_VALUE=&rem.&I;
SQL SQLORA SET SERVER &&CONNECTION_NAME
SQL SQLORA
-TYPE &I;
EX TEST_INSERT_UPDATE_RPT_STUDENT(&I,'&REMARK_VALUE');
END
-SET &I=&I+1;
-IF &I EQ &RecordCount1+1 GOTO ENDLOOP;
-GOTO LOOP
-ENDLOOP
-HTMLFORM BEGIN
<html>
<body >
[b]Record updated successfully[/b]
</body>
</html>
-HTMLFORM END
-*---End-Insert Record
-EXIT_INSERT
-*-Start-Report Data
-*---Start-Total number of records
SQL SQLORA SET SERVER &&CONNECTION_NAME
SQL SQLORA
EX TEST_STUDENT_COUNT &NO_OF_RECORDS;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS DATA_COUNT
END
-*TABLE FILE DATA_COUNT
-*PRINT
-*T/A40 NO NOPRINT
-*END
-RUN
-READ DATA_COUNT &T.A40.
-SET &A=&T;
-SET &A = TRUNCATE(&A);
-TYPE &A;
-*---End-Total number of records
SQL SQLORA SET SERVER &&CONNECTION_NAME
SQL SQLORA
EX TEST_STUDENT_DATA &PG,&NO_OF_RECORDS;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS DATAFILE
END
DEFINE FILE DATAFILE
   REMARKS/A255 = '<input maxlength="10" type="text" value="' || REMARKS || '" name="rem' || ID || '" >';
END
TABLE FILE DATAFILE
PRINT
 'DATAFILE.DATAFILE.ID'
 'DATAFILE.DATAFILE.STUDENT_ID' AS 'STUDENT ID'
 'DATAFILE.DATAFILE.REMARKS' AS 'REMARKS'
HEADING
"Student Information"
ON TABLE HOLD AS HLDS FORMAT HTMTABLE
END
-SET &SHOWBUTTON = IF &A GT 1 THEN '' ELSE 'none';
-IF &LINES EQ 0 THEN GOTO NO_DATA ELSE PIECE_DATA;
-PIECE_DATA
-HTMLFORM BEGIN
<html>
<head><title>WebFOCUS Report with paging</title>
<script type="text/javascript">
function runrep(direction)
{
 var frm = document.WForm;
 var totalpage=parseInt(&A);
 if (direction == 'prev')
 {
  if(parseInt(frm.PG.value)>1)
  {
   frm.PAGE_C.value=frm.PG.value;
   frm.PG.value--;
   frm.submit();
  }
  else
  {
   alert("You are in the report First Page");
  }
 }
 if (direction == 'next')
 {
  if(parseInt(frm.PG.value)<totalpage)
  {
   frm.PAGE_C.value=frm.PG.value;
   frm.PG.value++;
   frm.submit();
  }
  else
  {
   alert("You are in the report Last Page");
  }
 }
 if (direction == 'submit')
 {
  frm.PAGE_C.value=frm.PG.value;
  frm.submit();
 }
 
}
</script>
</head>
<body>
<form name="WForm" action="/ibi_apps/WFServlet" method="post">
<input type="hidden" name="IBIF_ex" value="test_dynamic_input_p.fex">
<input type="hidden" name="TOTAL_PG" value="&A">
<input type="hidden" name="PG" value="&PG">
<input type="hidden" name="PAGE_C">
<input type="hidden" name="SUBMITTED" value="1">
<input type="hidden" name="txtRecordCount" value="&LINES">
<table>
<tr>
<td><input type="button" style="display:'&SHOWBUTTON'" value="Prev" onClick="runrep('prev')"/></td>
<td><input type="button" style="display:'&SHOWBUTTON'" value="Next" onClick="runrep('next')"/></td>
<td><input type="button" value="Submit" onClick="runrep('submit')"/></td>
<td><input type="reset" value="Reset"/></td>
</tr>
</table>
!IBI.FIL.HLDS;
</form>
</body>
</html>
-HTMLFORM END
-EXIT
-NO_DATA
-HTMLFORM BEGIN
<html>
<body >
<center>
[b]No data exists[/b]
</center>
</body>
</html>
-HTMLFORM END
-*-End-Report Data

 


TEST_STUDENT_COUNT procedure code is given below
 
CREATE OR REPLACE PROCEDURE "TEST_STUDENT_COUNT"(NOOFRECORDS IN NUMBER DEFAULT NULL,
                                       RC1         OUT SYS_REFCURSOR) AS
  RECCNT     NUMBER(6, 2);
  TOTALPAGES NUMBER(10, 0);

BEGIN
  TOTALPAGES := 0;
  BEGIN
    SELECT COUNT(1)
      INTO RECCNT
      FROM STUDENT;
  
    TOTALPAGES := CEIL(RECCNT / NOOFRECORDS);
  
    OPEN RC1 FOR
      SELECT TO_CHAR(ROUND(TOTALPAGES)) AS T FROM DUAL;
  
  END;
END "TEST_STUDENT_COUNT";
 


TEST_STUDENT_DATA procedure code is given below
 
CREATE OR REPLACE PROCEDURE "TEST_STUDENT_DATA"(PAGENO      IN NUMBER DEFAULT NULL,
                                        NOOFRECORDS IN NUMBER DEFAULT NULL,
                                        RC1         OUT SYS_REFCURSOR) AS
  RECCNT NUMBER(6, 2);
  FROM_  NUMBER(10, 0);
  TO_    NUMBER(10, 0);

BEGIN

  BEGIN
  
    SELECT COUNT(1)
      INTO RECCNT
      FROM STUDENT;
    FROM_ := ((PAGENO - 1) * NOOFRECORDS) + 1;
    TO_   := FROM_ + (NOOFRECORDS - 1);
  
    OPEN RC1 FOR
      SELECT to_char(ROWNUM) ID, STUDENT_ID,REMARKS
        FROM STUDENT
       WHERE ROWNUM >= FROM_
         AND ROWNUM <= TO_;
  
  END;
END "TEST_STUDENT_DATA";

 


TEST_INSERT_UPDATE_RPT_STUDENT procedure is given below
CREATE OR REPLACE PROCEDURE TEST_INSERT_UPDATE_RPT_STUDENT(V_R_NO    NUMBER,
                                                    V_REMARKS VARCHAR2) IS

  R_COUNT    NUMBER;
  V_STUDENT_ID NUMBER;
 

BEGIN

  SELECT STUDENT_ID
    INTO V_STUDENT_ID
    FROM STUDENT
   WHERE ROWNUM = V_R_NO;

  SELECT COUNT(1)
    INTO R_COUNT
    FROM RPT_TEST_STUDENT
   WHERE STUDENT_ID = V_STUDENT_ID;

  IF R_COUNT = 1 THEN
    UPDATE RPT_TEST_STUDENT
       SET REMARKS = V_REMARKS
     WHERE STUDENT_ID = V_STUDENT_ID;
  ELSE
    INSERT INTO RPT_TEST_STUDENT
      (STUDENT_ID, REMARKS)
    VALUES
      (V_STUDENT_ID,V_REMARKS);
  END IF;
  COMMIT;
END;
  



Happy coding......... Smiler

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


WebFOCUS 7.6.1
Windows, All Outputs
 
Posts: 50 | Location: Scun-thorpe,UK | Registered: November 14, 2012Report 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     [SOLVED] Dynamic Text box on HTML form - Webfocus

Copyright © 1996-2020 Information Builders