Hi there
How do i select fields from different tables when writing reports...
What i am trying to do is..
lets say the name of the table that i am working on is called e.g. Price line Table and i want to include maybe( e.g Price) as one of the fields in my report section
Remember that "Price" is from a different table.
I tried to define my other table in globals as a record
and
on AfterGetRecord()
PriceLine."Purchase Price" := Item."Price";
//this was just my idea, i'm not
even sure that this is a correct method to do it! :?:
I really dont know how to make it select the price from Item table
Pls help
Comments
Through Code...create a variable for Item table and use the Setcurrentkey and the GET or Find to link key fields in the two tables. Then use the Var. = Var feature.
Through the DataItem ...
list Item Table as a DataItem, then indent and go to properties and use the DataItemLike.
You must have some field on PriceLine that refers to an item no.
Lets say that field is caled PriceLine."Item No".
Next step is retrieve that item from the Item table.
TWO WAYS:
0. PriceLine.TESTFIELD("item no.");//only if needed
1. Item.GET("item no."); //the best, because the item no is unique
2. Item.SETRANGE("No.", PriceLine."item No");//filter table
Item.FIND('-'); //retrieve record
3. Finally
PriceLine."Purchase Price" := Item."Price";
All this assumes that you define a variable named Item, of type Record, subtype = Item, and ofcourse a valid Item number is used.
Leonardo DaVinci