IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#21101 - 02/17/09 08:50 AM Working with xml & conditions.
Phree Offline
OL Expert

Registered: 09/26/02
Posts: 465
Loc: South Coast, UK
Hi,

I am using an xml file for the first time and everything is coming together nicely...However, some of my fields haven't been populated to show 2 decimal places when the last decimal is a zero. So when I look at the datafile, instead of:

Code:
<CURRENT_TAX>81.50</CURRENT_TAX>
I'm getting:
Code:
<CURRENT_TAX>81.5</CURRENT_TAX>
Being new to xml, I'm not sure if I could formulate a condition to add that zero on the end? It's either that or I'm thinking I may need to write a script to run against the data file before loading into my form...?

Thanks smile

Top
#21102 - 02/17/09 09:24 AM Re: Working with xml & conditions.
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Phree,

The easiest way to do it may be to convert the value to a currency and back to string. Some PressTalk may be required.

Assuming the following XML structure(just to give you an example):
Code:
 
<Data>
  <Taxes>
    <CURRENT_TAX>81.5</CURRENT_TAX>
  </Taxes>
</Data>
You could use a custom data selection, and use the following expression:

=curtostr(strtocur(xmlget('/Data/Taxes/CURRENT_TAX')))

By converting 80.5 to currency, and back to string, it will automatically add the 0.

Hope this helps.

Regards,
Rapha

Top
#21103 - 02/17/09 09:36 AM Re: Working with xml & conditions.
Phree Offline
OL Expert

Registered: 09/26/02
Posts: 465
Loc: South Coast, UK
Rapha

Top


Moderator:  cosimo, OL Newsgroup Support