Question How can I update the var value in to a temp table - from a Java function

Hi ,
Good Day!

Kindly help me in update the variable values f1 & f2 (which are the out put of the function - codeAddress ) to the temp table fields varOut1 & varOut2 after the each call in the for each loop.

TIA
-Philip-

Code:
<script language="speedscript">
def var vardatain as dec.
def temp-table tfdata
  field varIn as int
  field varOut1 as dec
  field varOut2 as dec.

Procedure cal.
create tfdata.
Assign
tfdata.varin = 300.
create tfdata.
Assign
tfdata.varin = 400.

for each tfdata.
  {&OUT} "<script language='JavaScript' type='text~/JavaScript'>" SKIP.
  {&OUT} "codeAddress(" + string(tfdata.varin) + ");" skip.
  {&OUT} "<~/script>" SKIP.
End.
END PROCEDURE.
</script>
<html>
<head>
<script type="text/javascript"></script>
<script type="text/javascript">
  function codeAddress(vardatain) { 
  var f3 = vardatain;
  var  f1 = 10 + f3;
  var  f2 = 20 + f3;
  };
</script>
</head>
  <body>
  <!--Div that will hold the pie chart-->
  <!--WSS RUN cal. -->
 
Last edited by a moderator:

lee.bourne

Member
In the example you've given below there's no reason why you couldn't calculate the values of varOut1 and varOut2 in Progress and dispense with the javascript entirely. However, I suspect you've just written it like this as an example. In general there are 3 ways to send data back to Progress from a webpage:

  1. Put the values in hidden INPUT html form elements and then submit the form (effectively refreshing the page) and use Progress's get-value(<fieldname>) function to get the values
  2. Use javascript AJAX routines to submit the values to a Progress webpage (without having to refresh the page)
  3. Via cookies. Cookies set via javascript can be read by Progress (get-cookie?) when a page is refreshed

Hope that helps,

Lee


Hi ,
Good Day!

Kindly help me in update the variable values f1 & f2 (which are the out put of the function - codeAddress ) to the temp table fields varOut1 & varOut2 after the each call in the for each loop.

TIA
-Philip-


<script language="speedscript">
def var vardatain as dec.
def temp-table tfdata
field varIn as int
field varOut1 as dec
field varOut2 as dec.

Procedure cal.
create tfdata.
Assign
tfdata.varin = 300.
create tfdata.
Assign
tfdata.varin = 400.

for each tfdata.
{&OUT} "<script language='JavaScript' type='text~/JavaScript'>" SKIP.
{&OUT} "codeAddress(" + string(tfdata.varin) + ");" skip.
{&OUT} "<~/script>" SKIP.
End.
END PROCEDURE.
</script>
<html>
<head>
<script type="text/javascript"></script>
<script type="text/javascript">
function codeAddress(vardatain) {
var f3 = vardatain;
var f1 = 10 + f3;
var f2 = 20 + f3;
};
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<!--WSS RUN cal. -->
 
Yes It is an example only. My wish , it would it work like a - Progress Procedure file - No UI interface.
Each iteration of the for each loop will call the Java function (it is doing now) give output - f1 and f2 and update the other fields of the temp-table varOut1 & varOut2.

Thanks much for the reply.
-Philip-
 
Top