using multilevel relationships in calculated fields

Hi,

Is there any way to access information more than one table away in a calculated field? Since the databasemanager funtions don’t seem to be available in calculated fields, I can’t think of a way to get distant information…

Thanks,

Andrew

Sure. You could do something like

return relation_1.relation_2.calc_field;

You should make sure, however, that those relations are valid (as with any relation). Otherwise you get an error.

thank you! Likewise, can I use this technique in methods? i.e. if I have two relations, orders_to_items & items_to_invoices, can I do this:

orders_to_items.items_to_invoices.setSelectedIndex(n)

or

orders_to_items.items_to_invoices.newRecord()

?

Just try! :wink: But yes, you can do that. Just be aware of what happens if your relation points to multiple records!

myRelation.mySecondRel.myThirdRelation.newRecord()

If it does apply to multiple records, I should be able to handle the selected record using setSelectedIndex(n) … correct?

Also, I could be wrong, but this doesn’t seem to be working with finds… i.e.

find()

table1_to_table2.table2_to_table3.f00 = bar

search()

Doesn’t seem to work…? or does it???

Anyone know?

It is possible to do

controller.sort(“table1_to_table2.table2_to_table3.f00”)