Focal Point
[SOLVED] Leading Spaces Padding in HTML Text Box

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

October 17, 2014, 05:36 PM
Ryan N
[SOLVED] Leading Spaces Padding in HTML Text Box
Hello, I am having an issue I am trying to solve with a text box in HTML composer. Leading spaces are being added to the number in a string when displayed in a text box on an HTML composer page, but not in the raw XML output, even though || is used for concatenating a $ sign. The number of leading spaces is the length of the number minus the the length specified in the second argument of FTOA. So if the length of that argument matches the length of the number there are no spaces between the number and the $ sign.

DEFINE FILE CAR
FTOA(PLAN_INFO.SEG01.PLAN_ASSETS, 'A20V', 'A20V'), 20, ' ', 1, 'A20V');
COST1/A150V= '$'||FTOA(CAR.BODY.DEALER_COST, '(D12)', 'A50V');
END
TABLE FILE CAR
SUM COST1
ON TABLE PCHOLD FORMAT XML
END  


XML Output:
  
<?xml version="1.0" encoding="UTF-8" ?> 
- <fxf version="1.0" data="hold">
- <report records="18" lines="1" columns="1" rows="1">
  <target format="" version="" type="" destination="HOLD" /> 
- <column_desc>
  <col colnum="c0" fieldname="COST1" alias="E01" datatype="char" width="150" focus_format="A150V" description="" accept="" help_message="" title="" property="" reference="" valign="left" /> 
  </column_desc>
- <table>
- <tr linetype="data" linenum="1">
  <td colnum="c0">$ 4,631</td> 
  </tr>
  </table>
  </report>
  </fxf>


Text box output (when used as a dynamic procedure in HTML composer for a text box):

$          4,631  


Any suggestions? Any of the usual ways to get rid of the spaces with concatenation or functions do not seem to work with the text box output.

thanks

This message has been edited. Last edited by: <Kathryn Henning>,


WF: WebFocus 8.0.02
InfoAssist, Dev Studio, Magnify, Portal/Dashboards, Mobile Favs
Data: DB2
OS: Windows
Output: Multiple
October 18, 2014, 12:30 PM
Tony A
Try this -

COST1/A25= '$'||LJUST(24, FPRINT(DEALER_COST, 'D12', 'A24'), 'A24');


Although if you want to prefix the monetary symbol then just use the correct incoming format -

COST1/A25= LJUST(25, FPRINT(DEALER_COST, 'D12M', 'A25'), 'A25');


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 
October 19, 2014, 05:17 AM
Alan B
Just a note on concatenation. The strong concatenation || affects the left argument in the expression, removing trailing spaces for that argument, so does not affect leading spaces on the right hand argument which remain in place.

Also the XML produced shows a single space, but a view source will show that multiple spaces in raw HTML are reduced to 1 space when displayed. Try a view source on the XML output and you will see the full multiple spaces that end up in the text box.

Tony's second example is probably the easiest solution.


Alan.
WF 7.705/8.007
October 20, 2014, 07:56 AM
MattC
If all else fails, check the Control itself and you &DEFAULT in your fex. If you are setting it to " " it will pick it up in the control.

I get caught on that all the time.

There are spaces between the double quotes.

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


WebFOCUS 8.1.05
October 20, 2014, 10:04 AM
Francis Mariani
In my opinion, FPRINT is a great function, except for the right-justification. I don't see why it doesn't left justify, there's no logical reason to preserve the leading blanks.


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
October 20, 2014, 11:28 AM
Ryan N
Thanks for the quick responses. The suggested formatting worked. I am still fairly new to wf and don't have all the formatting tricks and functions memorized yet, this was very helpful.


WF: WebFocus 8.0.02
InfoAssist, Dev Studio, Magnify, Portal/Dashboards, Mobile Favs
Data: DB2
OS: Windows
Output: Multiple