Options

TableRelation issue [SOLVED WITH WORKAROUND]

giannimigiannimi Member Posts: 2
Hi everybody
i'm trying to setup a conditional table relation for a textbox on a form, based on the value of a field in the current SourceTable record. I know this is quite trivial but somehow i can't get it to work properly.

The form simply shows records from a custom table, which contains an option "Type" field with a few possible values. The user should be able to select a Bank Account or G/L Account depending on the Type field value for the current record, and store it in a variable; then a Codeunit will be run which creates some ledger entries. So i created a textbox and set the proper SourceExpression and the conditional TableRelation, which is displayed in the textbox properties as
IF (Type=FILTER(Value1|Value2)) "Bank Account".No. ELSE IF (Type=FILTER(<>Value1&<>Value2)) "G/L Account".No.
When i run the form the lookup always opens on the first reference table, i.e. Bank Account - and if i type the account no. the validation happens against the same table as well.

I've even tried modifying the property, explicitly listing the option values which should point to G/L Account, in order to avoid the "different from this and different from that" form which was not allowed in the native DB, although i'm on a NAV2009SP1 Classic with SQL. No good.

You may note that the only difference from the usual conditional relationship you find in a lot of standard tables (37, 39, 81, etc) is that the TableRelation property is set on a control with a variable and not a field as its SourceExpression... but i'm pretty sure i've already done something like that in the past and never met any difficulties.

I'm obviously overlooking something... but what could it be?

Thanks for your help
Gianni

[UPDATE]
I added a field in my custom table, used it for the input and then in the OnValidete trigger for that field set the variable i was using before... this works. But i still think it should work even when directly using the variable, so any suggestion would still be very appreciated

Thanks
Gianni
Sign In or Register to comment.