How to get a value row wise in same column?

Hi,

I am using ax 2009. my reqirement is for eg :

select Amount from PayrollLedgerTable where PayrollLedgerTable.PeriodFrom == _PeriodFrom && PayrollLedgerTable.PeriodTo == _PeriodTo && PayrollLedgerTable.PeriodId == _PeriodId && PayrollLedgerTable.EmplId == _employee;

For single employee id we have so many columns(amount) which is basic, allowance etc…

i need to displsy in text file for single employee id amount(001, 25000,1000,2345,3434,etc)

How to achieve this in dynamics ax 2009? a new to dynamics. pls reply ASAP.

already generated the text file with all requirement. now remaining is i need to include this data by row wise format in that file.

You already know how to get a single field, so what’s the problem with getting the other fields? It’s just select Amount, AnotherAmount, YetAnotherAmount from payrollLedgerTable (…).

Or is Amount an array field? Then you would access individual fields by index, e.g. payrollLedgerTable.Amount[1].

Hi Martin,

Yes, i need to get amount, another amount, another amount etc in same row for particular employee id in single table

eg:(10001(empid), 1500(amount),1200(another amount),1400(another)…so on]

how to achieve this in ax 2009?

Thanks

So where are the amounts stored? Is it another case than those two I described above?

Sorry martin,

i have one amount cloumn in payrollledger table with many rows with employee id and different pay element code rows…

i need to display column amount value in row wise(first payelemt code amount, second pay elelmentcode amount, tdird payelement code, so on) for select employee id

table look like

Eg: empid, payelementcode, amount

001 basic 1500

001 pf 500

001 transport 350

001 allowance 100

now i want to display (001, 1500,500,350,100) in text file. how to do this? pls reply

Aha, got it. Iterate through the records, convert each amount to string and either join it to a common string or add to a container (you’ll concatenate it to a single string by con2str()).

Please can you tel me or give some example about this clearly. i cant able to get any idea in AX(X++). Really, It will be very helpful for me.

Thanks in advance

I don’t have enough information about how you want to sort and format values, nevertheless you may do, in general, something like this:

container amounts;
str s;

while select Amount from payrollLedgerTable
    where ...
{
    amounts += num2str( payrollLedgerTable.Amount,
                        1,
                        2,
                        DecimalSeparator::Dot,
                        ThousandSeparator::None);
}
s = con2str(amounts, ',');

Thanks a lot Martin!! It works…