Focal Point
How can I pass a data more than 5000 character acrross FEX?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4451090552

November 01, 2007, 06:36 AM
johney
How can I pass a data more than 5000 character acrross FEX?
Hi All,

I have a data is of LONG/CLOB type in my database and I need to pass this to a database table by a button click. I am attaching my code for better understanding.

Code in my testareapass.fex(Calling form)
----------------------------
Note :- I have changed the < to } inorder to avoid the creation of the objects in this editor


TABLE FILE WFTST_LONG
PRINT
TST_CLOB
WHERE ID=1
ON TABLE HOLD AS HOLD1 FORMAT ALPHA
END
-HTMLFORM BEGIN
-{html}
-{head}
-{title}Insert FTM file in Select{/title}
-{/head}
-{body}
-{form name=form action=WFServlet target=_blank}
-{input type=hidden name=IBIF_ex value=postdata.fex}
-{span style="position:absolute; top:180; left:10;"}Textarea{/span}
-{textarea name=sqlqryta style="position:absolute; top:180; left:200;" rows="10" cols="72" value=" "}
-INCLUDE HOLD1.ftm
-{/textarea}
-{INPUT onclick="do_escape[);" style="POSITION: absolute; TOP: 470px; LEFT: 160px; WIDTH:
80px; HEIGHT: 30px;" type="button" value=Submit}
-{/form}
-{script language=javascript}
-function do_escape() {
- TXobj = document.getElementById("sqlqryta");
- TXobj.value = escape(TXobj.value);
- document.form.submit();
- TXobj.value = unescape(TXobj.value);
-}
-{/script}
-{/body}
-{/html}
-HTMLFORM END

Please note that , I am directly assigning the HOLD.ftm as the value for the textarea.

code in by postdata.fex
-------------------------
-TYPE sqlqryta &sqlqryta
-EXIT
ENGINE SQLORA SET DEFAULT_CONNECTION myconn
SQL SQLORA
EX wfpackage1.p_tst_long_clob '&sqlqryta';
END

(I have commented the package call to see whether values are coming to the FEX)

Here I am able to pass upto 4700 characters (including the escaped ones lke %20). If I exceed this i will get an error as
Unknown error occurred.
ERROR:

I need to pass atleast 10000 characters to the postdata.fex and save to the database table

Or

Can I call the oracle package from the the
testareapass.fex button on click (From Javascript)?

Any suggestions ?

Thanks and regards,
Johney.


Version 7.6.11
Webfocus installed in AIX 5.3,
desktop PC: Windows-XP based
Output: Excel, HTML, PDF
November 01, 2007, 07:52 AM
GamP
Johney,
You can put your code into the tags [ code ] and [/code ]. It is the red right most icon of the entry box. It will then look like this:
-HTMLFORM BEGIN
<html>
<head>
<title>Insert FTM file in Select</title>
</head>
<body>
<form name=form action=WFServlet target=_blank method=post>
<input type=hidden name=IBIAPP_app value=gerard>
<input type=hidden name=IBIF_ex value=postdata.fex>
<span style="position:absolute; top:180; left:10;">Textarea</span>
<textarea name=sqlqryta style="position:absolute; top:180; left:200;" rows="10" cols="72" value=" ">
-INCLUDE HOLD1.ftm
</textarea>
<INPUT onclick="do_escape();" style="POSITION: absolute; TOP: 470px; LEFT: 160px; WIDTH:
80px; HEIGHT: 30px;" type="button" value=Submit>
</form>
<script language=javascript>
function do_escape() {
 TXobj = document.getElementById("sqlqryta");
 TXobj.value = escape(TXobj.value);
 document.form.submit();
 TXobj.value = unescape(TXobj.value);
}
</script>
</body>
</html>
-HTMLFORM END

This code by the way will work for the maximum length of an &variable, which is 32KB. The trick is in the METHOD=POST within the form declaration.
You did not put anything there, which then will default to METHOD=GET. This will create a URL with all text in it, and is limited in length. METHOD=POST does not have this limitation.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 01, 2007, 09:52 AM
johney
Thanks GamP for converting my code with actual syntax,

So there are no tricks to pass more than 32KB? How can I understand that 4700 character is crossing 32KB. My requirement is to pass atleast 10000 characters including escape characters.

Is there any way that we can call the oracle precedure from the button click event? If that is possible we need not pass this to a second fex to call a oracle package. Any idea ?

Thanks and regards,
Johney.


Version 7.6.11
Webfocus installed in AIX 5.3,
desktop PC: Windows-XP based
Output: Excel, HTML, PDF
November 01, 2007, 09:59 AM
Francis Mariani
Did you try adding method=post to your form tag as GamP suggested? That ought do it.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 02, 2007, 03:17 AM
johney
Yes Francis,

I have selected "post" method only.I am clueless about what is happening .

Thanks and regards,
Johney.

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


Version 7.6.11
Webfocus installed in AIX 5.3,
desktop PC: Windows-XP based
Output: Excel, HTML, PDF
November 02, 2007, 11:12 AM
dhagen
Passing a textarea is always tricky. Can you post the code of your postdata.fex? I've used the IBIF_adhocfex in the past for posting large textarea values, but you will need to include your code in the textarea. Something like:

<textarea name="IBIF_adhocfex">
MODIFY FILE X
FREEFORM Y/TX80
COMPUTE SOMEKEY=SOMEVALUE;
MATCH SOMEKEY
ON NOMATCH INCLUDE
DATA
Some really frikin huge amount of data .... <== this is where your file would go.
%,$
END
</textarea>  


Or something like that ... I'm going off memory for this one.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
November 03, 2007, 03:28 AM
johney
Hi dhagen ,

I have just a TYPE command in the postdata.fex as,

-TYPE sqlqryta &sqlqryta

This is giving me error if the no.of characters passes from the calling FEX is greater than 4700 even in "method=post"

Are you suggesting me to change the name of textarea as IBIF_adhocfex and include the MODIFY FILE etc inside the textare ? Do you have code snippet which will work ?

Thanks and regards,
Johney.


Version 7.6.11
Webfocus installed in AIX 5.3,
desktop PC: Windows-XP based
Output: Excel, HTML, PDF
November 03, 2007, 02:17 PM
dhagen
I did the following test with 16K+ characters without an error.

Master
FILENAME=sometable, SUFFIX=XFOCUS  ,
 DATASET=baseapp/sometable.foc, $
  SEGMENT=SOMETABLE, SEGTYPE=S1, $
    FIELDNAME=KN, ALIAS=KN, USAGE=A3, ACTUAL=A3, $
    FIELDNAME=TA, ALIAS=TA, USAGE=TX80, ACTUAL=TX80, $  


Html:
  
<html>
     <head>
          <script type="text/javascript">

          function sendThis(obj) {
               var tempTextarea = obj.IBIF_adhocfex.value;
               obj.IBIF_adhocfex.value = "-SET &ECHO=ALL;\n" + 
                                          "MODIFY FILE SOMETABLE\n" + 
                                          "FREEFORM KN TA\n" + 
                                          "MATCH KN\n" +
                                          "ON NOMATCH INCLUDE\n" +
                                          "DATA\n" +
                                          tempTextarea + "\n%$\n" +
                                          "END\n" + 
                                          "-RUN\n" +
                                          "TABLE FILE SOMETABLE\n" +  
                                          "PRINT TA BY KN\n" + 
                                          "END\n" +
                                          "-RUN"
              obj.submit();
          }

          </script>
     </head>
     <body>
          <h2>Test Textarea</h2>
          <form id="f1" action="/ibi_apps/WFServlet" method="post">
               <textarea id="ta1" name="IBIF_adhocfex" cols="100" rows="40"></textarea>
               <input id="hd1" type="hidden" value="baseapp" name="IBIAPP_app" />
               <input id="pb1" type="button" value="Try Me!" onClick="sendThis(this.form);" />
          </form>
     </body>
</html>


Note: to test, enter a key value followed by a comma in the textarea before entering the large amount of data ... this is just to test afterall!
Hope this helps.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott