Focal Point
[SOLVED] text box in a fex

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

September 07, 2008, 10:47 PM
Donald
[SOLVED] text box in a fex
I have a report that requires the users to input some values into a text box. I am not using the html layout painter, so I would like the text box to be within the fex. Is this possible?

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


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 08, 2008, 03:52 AM
GamP
There are only afew things that you can't do with WebFOCUS. This is not one of them, so yes it can be done. There are basicly two ways: the first means that you code your variables with a list of choices and let the autoprompt facility handle the rest. The second is that you code the html code in your fex, and run it; this means you;ll need a second fex to receieve the selected values.
I'm sure there are a lot of examples to be found, either within this forum, or on the IB tech support site.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 16, 2008, 04:01 PM
Donald
I have a field called forecast which has values
and I need a text box for the users to input suggested forecast
sales: 100 200 300 500 800 900
forecast: 100 200 300 400 500 600
sug fct: ___ ___ ___ ___ ___ ___


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 16, 2008, 04:33 PM
Fernando
Donald,

Here is an example:

DEFINE FILE CAR
 INFLD/A255='<INPUT value=' | EDIT(RETAIL_COST) | ' name="SALESTEXT">';
END
TABLE FILE CAR
PRINT
CAR
INFLD
END


Use FTOA if you do not want the leading zeros in your value.

Fernando


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
September 16, 2008, 04:49 PM
Donald
THAT LOOKS GREAT!!! except for the leading zeros. I hate to sound ignorant, but can you show me where the FTOA would go in the code.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 16, 2008, 04:54 PM
GinnyJakes
You would add a field to the define in front of the INFLD to convert the field to alpha and specifiy a format that omits leading zeros. Then use that alpha field in the INFLD definition without the EDIT command.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
September 17, 2008, 03:47 AM
Tony A
... and to learn about using functions such as FTOA, look towards your manuals of use the search function top right Smiler

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 
September 17, 2008, 10:58 AM
Donald
It works for thje cars database,but for my application a am getting a blank text box instead of the quantity field.

ALPHA_FCT/A30 = FTOA(CURRQTYF, '(D20)', ALPHA_FCT);
INFLD1/A100='';


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 17, 2008, 11:01 AM
Donald
ALPHA_FCT/A30 = FTOA(CURRQTYF, '(D20)', ALPHA_FCT); INFLD1/A100='';


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 17, 2008, 11:02 AM
GinnyJakes
Make sure that you put your code between the code tags, the red icon to the right of the posting box.

This works:
DEFINE FILE CAR
 ALPHA_FCT/A30 = FTOA(RETAIL_COST, '(D20)', ALPHA_FCT);
 INFLD/A255='<INPUT value=' | ALPHA_FCT | ' name="SALESTEXT">';
-* INFLD/A255='<INPUT value=' | EDIT(RETAIL_COST) | ' name="SALESTEXT">';
END
TABLE FILE CAR
PRINT
CAR
INFLD
END



Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
September 17, 2008, 12:39 PM
Donald
that works now.. I had "SET SHOWBLANKS = ON" so by textbox was blank.. thanks for the advice.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 17, 2008, 01:06 PM
Donald
Last question is can I right justify the values in the text box.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 17, 2008, 01:34 PM
mgrackin
Donald,

There is some residual effects from the FTOA that you need to deal with. The FTOA function leaves leading blanks in the value. If you look at the source code of the report results you will see all the spaces.

Here is some code that eliminates the blanks and adds the right justification for the INPUT box. My original suggestion for adding align=right was incorrect.

DEFINE FILE CAR
ALPHA_FCT/A30 = FTOA(RETAIL_COST, '(D20)', ALPHA_FCT);
LEFTJ_FCT/A30 = LJUST(30,ALPHA_FCT,'A30');
INFLD/A255='<INPUT type="text" value="' || (LEFTJ_FCT || '" name="SALESTEXT" style="text-align:right">');
END
TABLE FILE CAR
PRINT CAR INFLD
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
September 17, 2008, 02:22 PM
EWoerle
I know I'm jumping in a little late, but this concept intrigued me and I decided to see if I could bring this a step further and make things update dynamically within the report according to user input using some simple javascript. Here is what I came up with. I don't know if it is useful for anyone but, I found it interesting.

Eric
 DEFINE FILE CAR
RETAIL/A16=FTOA(RETAIL_COST,'(D12CM)',RETAIL);
END
TABLE FILE CAR
PRINT
-* INFLD
 COMPUTE CNT/I4=CNT+1;
 COMPUTE RETAIL_COST/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | ' value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE REBATE/A255='<INPUT id=rebate' | EDIT(CNT) | ' value="" onChange=projectFuture("' | EDIT(CNT) | '")>'; AS 'Rebate %'
 COMPUTE MULT_INFLD/A255='<span id=infld' | EDIT(CNT) | '>calculation</span>';
 BY CAR
END
-HTMLFORM BEGIN
<HTML>
<head>
<SCRIPT>
function projectFuture(num)
{
var costName='cost' + num;
var rebateName='rebate' + num;
var newCost=document.getElementById(costName).value * ((100 - document.getElementById(rebateName).value) / 100);
var idName='infld' + num;
document.getElementById(idName).firstChild.nodeValue=newCost;
}
</SCRIPT>
</HEAD>
-HTMLFORM END 



Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
September 17, 2008, 04:17 PM
Donald
WOW,this is interesting... The users acually want 12 text boxes where they can input a 12 month forecast and then start changing some numbers to see what that does to the total..After going to summit this year I thought I was ready for anything but this had me stuck until now.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 20, 2008, 02:28 PM
Doug
That's great Eric, I can't wit till I need it...
September 23, 2008, 01:24 PM
Donald
I need to save those values in the text box and send to someone for review. When I save the cars report with the javascript logic for calculations it opens with a blank text box instead of the value that was put into the text box.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 29, 2008, 01:44 PM
Donald
I still need someone to chime in on this..Is there a way to save this report with the calculated values?


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 30, 2008, 09:11 AM
PBrightwell
I think you are going to have to treat it like an input screen and write it to a file. You will need to incorporate a save button into the report.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
September 30, 2008, 01:51 PM
Donald
Can you give me an example using this cars report?

 DEFINE FILE CAR
RETAIL/A16=FTOA(RETAIL_COST,'(D12CM)',RETAIL);
END
TABLE FILE CAR
PRINT
-* INFLD
 COMPUTE CNT/I4=CNT+1;
 COMPUTE RETAIL_COST1/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_1 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE RETAIL_COST2/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_2 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE RETAIL_COST3/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_3 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE REBATE/A255='<INPUT id=rebate' | EDIT(CNT) | ' value="" onChange=projectFuture("' | EDIT(CNT) | '")>'; AS 'Rebate %'
 COMPUTE MULT_INFLD/A255='<span id=infld' | EDIT(CNT) | '>calculation</span>';
 BY CAR
END
-HTMLFORM BEGIN
<HTML>
<head>
<SCRIPT>
function projectFuture(num)
{
for (i=1; i<4; i++)
{
 var costName='cost' + num + '_'+i;
 var rebateName='rebate' + num;
 var newCost=document.getElementById(costName).value * ((100 - document.getElementById(rebateName).value) / 100);
 var idName='infld' + num;
}
document.getElementById(idName).firstChild.nodeValue=newCost;
}
</SCRIPT>
</HEAD>
-HTMLFORM END
 



Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
September 30, 2008, 06:19 PM
Waz
Donald, try this out.

I called the fex FP_DB_UPDATE

You will have to code the modify to do the update, and also pass back any key values.

-DEFAULT &PART='FORM';

-GOTO PGM_&PART

-PGM_UPDATE

-? &

-EXIT

-PGM_FORM
DEFINE FILE CAR
RETAIL/A16=FTOA(RETAIL_COST,'(D12CM)',RETAIL);
END
TABLE FILE CAR
PRINT
-* INFLD
 COMPUTE CNT/I4=CNT+1;
 COMPUTE RETAIL_COST1/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_1 name=cost' | EDIT(CNT) | '_1 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE RETAIL_COST2/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_2 name=cost' | EDIT(CNT) | '_2 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE RETAIL_COST3/A255=RETAIL | '<INPUT type=hidden id=cost' | EDIT(CNT) | '_3 name=cost' | EDIT(CNT) | '_3 value=' | EDIT(RETAIL_COST) | '>';
 COMPUTE REBATE/A255='<INPUT type=text id=rebate' | EDIT(CNT) | ' name=rebate' | EDIT(CNT) | ' value="" onChange=projectFuture("' | EDIT(CNT) | '")>'; AS 'Rebate %'
 COMPUTE MULT_INFLD/A255='<span id=infld' | EDIT(CNT) | '>calculation</span><INPUT type=hidden id=outfld' | EDIT(CNT) | ' name=outfld' | EDIT(CNT) | ' value="")>';
 BY CAR
ON TABLE HOLD AS RPT FORMAT HTMTABLE
END

-RUN

-HTMLFORM BEGIN
<HTML>
<head>
<SCRIPT>
function projectFuture(num)
{
for (i=1; i<4; i++)
{
 var costName='cost' + num + '_'+i;
 var rebateName='rebate' + num;
 var newCost=document.getElementById(costName).value * ((100 - document.getElementById(rebateName).value) / 100);
 var idName='infld' + num;
 var outName='outfld' + num;
}
document.getElementById(idName).firstChild.nodeValue=newCost;
document.getElementById(outName).value=newCost;
}
</SCRIPT>
</HEAD>
<body>
<form action="/ibi_apps/WFServlet" method="get">
<input type="hidden" name="IBIF_ex" value="FP_DB_UPDATE">
<input type="hidden" name="PART" value="UPDATE">
!IBI.FIL.RPT;
<br>
<input type="submit">
</form>
</body>
</html>
-HTMLFORM END



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!

October 01, 2008, 11:39 AM
Donald
Thanks for responding, I was starting to get worried that nobody could help with this one. I am not trying to save the values to a database,the users will be in a hotel plugging in values and then saving it to their local drive for later review. When they open the saved report they need to still see the values they put into the text box.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
October 01, 2008, 12:01 PM
EWoerle
If they want to save it to their local computers, why not just dump it into excel? you could always create a blank field and write your formula into the compute so that they don't need to worry about it. But if they want to be able to save and work with it locally, that would be the way I would go.


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7