Hello,
I think in the past soemthing like
if(relation)
returned false, if no related record existed. Now, the expression is always true, so you have to do
if(relation.getSize()>0)
Is that true and wanted?
Hello,
I think in the past soemthing like
if(relation)
returned false, if no related record existed. Now, the expression is always true, so you have to do
if(relation.getSize()>0)
Is that true and wanted?
to explain this as good as i can again (this question is asked a lot!)
2 types of relations:
1> orders (the PK, ordersid) → orderlines (the ordersid is FK)
and
2> orderlines (the ordersid is FK) → orders (the PK, ordersid)
now for the first one the relation can NEVER be null so you never have to do this:
if(relation) { }
This is because the PK ordersid is always there (the leftside of the relation)
if you want to test here if you have records you have to do this:
if(relation.getMaxRecordIndex() > 0)
in the second example the left side can be null (the FK ordersid doesn’t have to be there..)
Then the relation have to be tested with
if(relation)
So if the leftside can be NULL then the relation can be null (because you also can’t do relation.newRecord() on that one. That is impossible, because the relation isn’t there)
for type 1 you can do newRecord() because the relation is there even if it doesn’t contain records at the moment. But you can create one if you like.
i hope this is making it a bit more clearer.