Ledger Control Dimension

I would like a report to display a list of the chart of accounts with validating dimensions in the following layout: COLUMN 1 FullAccountNumber dim1-dim2-ledgeraccountnumber-dim3 Dim1, Dim2 and Dim3 values are in separate rows from the ledger control dimensions and I would like to concatenated this values to show like above. Also I would like all possible combinations to be shown. For example: Validation list for account number: A100 dim1 1 dim1 2 dim2 10 dim2 99 dim3 20 dim3 30 Based on the values shown in the picklist above, the Chart of Account Listing would look as follows: 1-10-A100-20 1-10-A100-30 1-99-A100-20 1-99-A100-30 2-10-A100-20 2-10-A100-30 2-99-A100-20 2-99-A100-30 How can I implement such a solution?

Well, the simpliest in thinking solution would be to create 3 separate arrays (or maps) for each dim# and then you can launch an iterator on each of them starting from dim1, making the line and outputting it with a programmable section call (element.execute(ProgSecNum)) This method is easy to understand at least :slight_smile:

Can I use a container instead of an array? How would the report know which number to output?

Well, when you use programmable Sections, you call the output of the line yourself. (what I wrote earlier: element.execute(1):wink: And in this programmable Section you put a string control, that outputs a line through a display method. and you form the stirng to output yourself before calling execute(1); and yes, you can use contrainers.

How would I use a map?

well, a map is a basic class used in Axapta. An example of using a map: map simap = new map(types::string, types::integer); simap.insert("Vanya",24); simap.insert("Tanya",56); print simap.toString(); pause; and here is a list of available methods: new (types keyType, types valueType), insert(anytype keyValue, anytype value), remove(anytype keyValue), lookup(anytype KeyValue), exists(anytype KeyValue), elements(), empty(), keyType(), valueType(), keySet(), valueSet(), toString(), definitionString(), pack(), create(container c), equal(map m1, map m2)

Ok but how would I use it in this case? Would I, for each account: Put all the Dim1 into a container Put all the Dim2 into a container Put all the Dim3 into a container Map those 3 containers to the account Then iterate through them and generate the combinations?

I think what you need to do is just stick to the container. Fill it in first, and then output it all at once to the report. By filling in, I mean the following: 1. you take the first accountNum. 2. fill in lines for all the dim1 for this account 3. fill in lines for all the dim2 for this account 4. fill in lines for all the dim3 for this account 5. take the next accountNum 6. go to 2. after this you will have a container of lines that are ready to ouput.

How can I tell if the account number changes? The combinations are dependent on the account.

What do you mean? you do this: while select accountNum from LedgerTable (don’t know if you select accounts from this table) { here you have 1 account number. you fill in the container with dim1 - dim3 for ledgerTable.accountNum } here you have all accountNums passed

you said: “you fill in the container with dim1 - dim3 for ledgerTable.accountNum” How can specify that those 3 containers belong to that particular account?

Hi, Cachelle Look, you fill in the lines of just one big container. and the elements of this container will be like the following: 1-10-A100-20 1-10-A100-30 1-99-A100-20 1-99-A100-30 2-10-A100-20 2-10-A100-30 2-99-A100-20 2-99-A100-30 And you fill it in for example like this. you have your accountNum in ledgerTable.accountNum you fill in 3 temp containers with dim1 - dim3 for this account. they will be like this: (containerName : elements) ConDim1: 1,2 ConDim2: 10,99 ConDim3: 20,30 and using them you fill in that one big container with lines listed above. then you go to the next accountNum, clear the 3 temp containers and leave the big one as it is. Hope this helps

Thanks much. Could you explain about creating the report and having this method called and output each line to the report. Where would I put the method? In the fetch and call the programmable section? Are there any examples in Axapta I can use?

Yes, there are plenty of examples in Axapta. That, by the way, is the main source (at least for me) of new code. You could declare the big container in the classDeclaration of the report, than in the init method of the report call the method to fill in this big container. and after filling it in you go through all its elements and call element.execute(1) for each of them. Just this line. And you can look at how programmable sections are created in Developer’s Guide, or in existing report, for example, LedgerBalanceSheetPrint or LedgerFiscalJournal_IT or any other. there are plenty Good luck! :slight_smile:

Thanks much for your help. Appreciate it!!