Converion from real to str

Hi,

i am reading a table record using the select query in X++.

now some of the table column are of type “money” which ia real type value. but when i try to write it to a table crated by me using the System.Data.datatable it doesnt work.

This is where it fails: row.set_Item(“February”,ProjectContractTable.ConvertedFirmAmount);

I have tried using any2real etc but to no avail.

Entire Code:

System.Data.DataTable tab;
System.Data.DataColumnCollection col;
System.Data.DataRow row;
System.Data.DataRowCollection rowCol;
PSL_PSAProjectContractProjection ProjectContractTable;
str pci;
real temp,i;
;

tab = new System.Data.DataTable();
col= tab.get_Columns();
col.Add(“PCID”);
col.Add(“Year”);
col.Add(“Month”);
col.Add(“January”);
col.Add(“February”);
col.Add(“March”);

rowCol = tab.get_Rows();

while SELECT * FROM ProjectContractTable
WHERE ProjectContractTable.ProjectContractID==“CON0001”
{
i=ProjectContractTable.ConvertedFirmAmount;
row= tab.NewRow();
row.set_Item(“PCID”,ProjectContractTable.ProjectContractID);
row.set_Item(“Year”,ProjectContractTable.FiscalYear);
row.set_Item(“Month”,int2Str(ProjectContractTable.FiscalMonth));
pci=ProjectContractTable.ProjectContractID;
temp=ProjectContractTable.FiscalMonth;
if(temp==1)
row.set_Item(“January”,i);
else
if(temp==2)
row.set_Item(“February”,ProjectContractTable.ConvertedFirmAmount);
else
row.set_Item(“March”,888);
}
rowCol.Add(row) ;

return tab;

Abhishe

TRY this

row.set_Item(“February”,num2str(ProjectContractTable.ConvertedFirmAmount,10,5,1,0));

Regard

P.Ram