Set currency formatting before exporting to CSV file.

Hi

I'm using the following ironpyhton script to create a CSV file.

...
cc7 = DataValueCursor.CreateFormatted(myDataTable.Columns["Vlr_Rda_Alt"])
cc8 = DataValueCursor.CreateFormatted(myDataTable.Columns["Vlr_Rda_Ant"])


for row in myDataTable.GetRows(marking.GetSelection(myDataTable).AsIndexSet(), cc1, cc2, cc3, cc4, cc5, cc6, cc7, cc8):
	
	rawdata = rawdata + '1' + separator
	rawdata = rawdata + (cc1.CurrentValue) + separator
	rawdata = rawdata + str(prfxG) + separator
	rawdata = rawdata + (cc2.CurrentValue.replace(',00', '')) + separator
	rawdata = rawdata + (cc3.CurrentValue) + separator
	rawdata = rawdata + (cc4.CurrentValue) + separator
	rawdata = rawdata + (cc5.CurrentValue) + separator
	rawdata = rawdata + (cc6.CurrentValue) + separator
	rawdata = rawdata + (cc7.CurrentValue) + separator
	rawdata = rawdata + (cc8.CurrentValue) + '\r\n'


Document.Properties["rawCsv"] = rawdata

When I print the rawdata variable I got the follwoing:

237;51;8888;876222;JONH LENON;SINGER;UK;09/10/1940;7215,00;5469,84

What I need is to format the last two numbers into currency, such as  (7,215.00 and 5,469.84) before sending them to the Document.Properties called "rawCsv" or even before to sending the value to rawdata variable.

I have looked for a solution on the Internet but al examples seems to be used with visualizations using System.Globalization.CultureInfo and doesn't apply to an Object. Is there any way to acomplish this in an easy way?

Regards,

 

Marcio

 

 

(1) Answer

Login