i know this may be a simple question, but i need to add a dimension code to a posted purchase inv. line, and the dimension is called "Employee". I am a newbie, and I know that you can have multiple Lines for each Header. Anyhow, I went to the Posted Puch. Invoice Subform, and I added a column called Employee Code. Anyhow, I was able to show the Dimension code when the form loads b/c I filtered the Posted Docuement Dimension by "Table ID", "Document No", and "Dimension Code". The problem I have is that when I have like 3 lines on the Posted Purch. Inv form, it shows for all 3 lines the Employee Code for the 1st line. This is not correct b/c each line can have a different Employee Code. I was thinking that maybe I can use an array and then assign the textbox for EMployee code on my form to the array, but I don't know if I can do this or not. Also i have looked on this forum and couldn't find how to declare arrays

Can someone please help me with this. How to declare arrays correctly. And if my method of assigining the SourceExpr for the textbox for Employee Code to the array will work, or is there another easy way of doing this??? I'm sure there has to be!!!! any help is greatly appreciated.
Comments
Have you tried assigning the value to your variable at the OnAfterGetRecord section of the subform? That should do it. Under most circumstances you shouldn't need to use an array. However, to set the dimensions of an array you need to look at the properties of your variable.
I hope I understood your need and that this helps.
Those of you who think you know everything are annoying to those of us who do. -
David Brent
In the OnAfterGetRecord of the Subform:
myvar := format("line no.");
myvar = code 10
I added a new column to the subform and made SourceExpr myvar
It shows each line number correctly.
So... I'm guessing your problem might be in the code you use to retrieve the dimension value for each line.
Those of you who think you know everything are annoying to those of us who do. -
David Brent
PostedDocDimension.RESET;
PostedDocDimension.SETRANGE("Table ID", DATABASE::"Purch. Inv. Line"); {filter by table "Purch.Inv.Line" b/c that is where the
Posted Invoice Doc go. }
PostedDocDimension.SETRANGE("Document No.","Document No."); {filters the "Document No." field in table PostedDocDimension with
the field named "Document No." that is in this table,"Purch. Inv. Line" }
PostedDocDimension.SETRANGE("Dimension Code", 'EMPLOYEE');
//Employee is the 3rd dimension I need to filter
IF PostedDocDimension.FIND('-') THEN
REPEAT
EmpCode:=PostedDocDimension."Dimension Value Code";
//this will only get the last match of Employee Code and set all
//lines in Posted Purchase Invoice(line) to it, which is wrong b/c
//they can be different.
UNTIL PostedDocDimension.NEXT <=0;
Here is how my code looks like in the OnAfterGetRecord()
this is of course incorrect b/c all the empcodes on the form will be the same. Are you suggesting that I use the FORMAT to format my source expression??? It makes sense when you do it, but when I try, it doesn't work. It may be where I place that line of code???
You could of course just do this:
The format in my example has nothing to do with your problem.. just a red herring I threw in
Those of you who think you know everything are annoying to those of us who do. -
David Brent
thanks,