Views in AX 2012

how to display Amount in words in View?

Example: i have a sales line table in my view ,i have line amt field in that table,now in view i have created my computed string field,in that field i need 2 display line amt in words.

create a display method and call the method Classes>>>>Global>>>numeralsToTxt

display method does not make a solution.

i wrote code like this

private static server str Amtwrds()

{

#define.ViewName(Atna_Salesorderview)

#define.DataSourceName(“Atna_Salestotalview_1”)

#define.Fieldtotalamt(“Sumoflineamount”)

str sReturn;

str sAccountNum;

str sSubsegmentId;

real num;

DictView dictView2;

// Construct a DictView object for the present view.

dictView2 = new DictView(tableNum(Atna_Salesorderview));

sAccountNum = dictView2.computedColumnString

(#DataSourceName,

#Fieldtotalamt,

FieldNameGenerationMode::FieldList,

true);

num=str2int(sAccountNum);

//Just tried with hard coding amt

sReturn=Global::numeralsToTxt_IN(100);

return sReturn;

}

Getting Error As :(if i create a string computed colum in view im getting error)


Cannot select a record in Atna_Salesorderview (Atna_Salesorderview).

The SQL database has issued an error.

you can use AmtInWords() function for displaying in words. but i dont know how to display in View

krishna

Hi Deepika,

Computed columns in view is not meant for calling AX methods
we can only use them to create columns like subquery of standard SQL.

e.g select *,(select sum(value) from markupTrans where tableId = salesline.tableid and refrecid = salesline.recid)

from salesline

If you can write standard SQL query to convert amount to text go ahead with it

otherwise you have to write simple display method on view