Relation into a calculation

Hi at all,

Maybe was already discussed but I haven’t find it,so I have a question:
Is possible to use a relation into a calculation?
I have this situation:

two table:

table A:
id,table_b_key(foreign key)

table B:
table_b_key,value

I need by starting from “table A” to make a relation with the “table B” and evaluate the field"value".

So I have done a relation that appear into the “relation_tab” when I’m in calculation mode but that doesn’t work.
[attachment=0]Calculation.JPG[/attachment]

Thanks in Advance

Marco

your relation is a N->1 relation so if the 1 (table b) doesnt exists, so the fk field of table a is null then the relation isnt there at all
You have to test for that with databasemanager.hasRecords()

I’m agree,but the record of table A are genereted from the table B so I’m sure that the record exist.

I have a similar situation:

I have a table “birthday” with all the day of the year with this struct:

  • birthday_id(int),date(as datatime),is_holiday

I have another table “man” with this struct:

  • man_id,birthday_id,name,surname,etc

When I create the tuple of table “man” than I inherit the birthday_id.
Now I would return ‘yellow’ into my RowBgCalculation if the field “is_holiday” isn’t null;

Now I start from the table “man”,I get the man.birthday_id and I want point to the birthday.birthday_id and so evaluate the relative “Is_holiday” field.
To do this I have build a relation “man.birthday_id—>birthday.birthday_id”
but as we can see by my screenshot the relation doesn’t work.

if birthday_id is there in man (not null)
and that does point to a valid birthday_id in the birthday_table then the relation that is just build on:

man.birtday_id → birthday.birthday_id

should work just fine in a calculation that is build on the man table.

If not make a sample solution and attach to a case.

Ok!

Thanks for your time!

Marco