Problem with FldRef.RELATION

Timo_Lässer
Member Posts: 481
I have a problem with FieldRef.RELATION.
I want to know, if a Field has a relation to another table. Therefore I use the FldRef.RELATION to find out the Table No.
If the field has a relation, all works fine. But if there is no relation, the fin.exe crashes.
I use 3.70 incl. HF12 (newest Runtime).
What's wrong?
I want to know, if a Field has a relation to another table. Therefore I use the FldRef.RELATION to find out the Table No.
If the field has a relation, all works fine. But if there is no relation, the fin.exe crashes.
I use 3.70 incl. HF12 (newest Runtime).
What's wrong?
RecRef.GETTABLE(MyTable); FldRef := RecRef.FIELD("Field No."); IF FldRef.RELATION <> 0 THEN BEGIN // <-- fin.exe crashes here if RELATION is 0 [...] END;
Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
0
Comments
-
i get the same errorLR0
-
It's a bug... that's what is wrong.
You should post it on the MBS bug report system and hope they will fix it."Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
Thanks for your reply.
I have already posted this in the partnersource but I expected that anybody have a workaround for this issue.
If anybody of you has further informations (or a workaround) to this, please let me know about this. (If I have news, I will post them here.)Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Look into table 2000000041 - Fields - there are all infos you want... 8)0
-
kine wrote:Look into table 2000000041 - Fields - there are all infos you want... 8)
I have some cases where the RelationTableNo is empty but the FldRef.RELATION has a value <> 0.Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Sorry, i forget this situation... yes, it must be found dynamicaly and this in table Fields is not possible.
This bug is old, no response from MBS... hmmm, this will be problem, sorry, cannot help you... :?0 -
kine wrote:no response from MBS
Today, I got the following answer from the Support:MBS-Support wrote:This issue will be corrected in the next release.Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
guys,
I'm not sure but please keep it in mind. I think the relation field in the "field" table is not always correct. I think.... (I THINK) is ofter not filled or 0 when there should be a value.
Just check it please!"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
eromein wrote:[...] the relation field in the "field" table is not always correct. [...]Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Ooooh sorry, just missed that post. Just a tought without checking it myself. Is there a way to find out if there is a condition defined?"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
eromein wrote:[...] Is there a way to find out if there is a condition defined?Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Moin Moin from the high north,
I has now everything tries out you comes simply not to the TableRelation reliably ran. This problem exists however already starting from the Financials Versions. The problem is which you over the table Field the TableRelation sees, but only if on the TableRelation no filter is. (here you could look at times the field Base Unit of Measure in the article, you no TableRelation there will unfortunately be). You come however neither over the Fieldref functionality nor over the Rec. TableRelation to the TableRelation ran.0 -
Ooooh darn, didn't realize this was a german forum. If I had known, I would have posted everything in german.
Ooooh wait... It's English :shock:"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
Maby not relevant any more but a possible workaround could be:
...
Field.GET(RecRef.NUMBER,FieldRef.NUMBER);
IF Field.RelationTableNo <> 0 THEN
MESSAGE('Field %1 has relation to table %2, field %3',Field."Field Caption",Field.RelationTableNo,Field.RelationFieldNo);
...
Field : Record 20000000410 -
krichter wrote:Maby not relevant any more but a possible workaround could be:
...
Field.GET(RecRef.NUMBER,FieldRef.NUMBER);
IF Field.RelationTableNo <> 0 THEN
MESSAGE('Field %1 has relation to table %2, field %3',Field."Field Caption",Field.RelationTableNo,Field.RelationFieldNo);
...
Field : Record 2000000041
This only works if the property TableRelation of the field has no condition or any other filter.
So, you cannot use this workaround if you use RecordRef / FieldRef.Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
krichter wrote:Maby not relevant any more but a possible workaround could be:
...
Field.GET(RecRef.NUMBER,FieldRef.NUMBER);
IF Field.RelationTableNo <> 0 THEN
MESSAGE('Field %1 has relation to table %2, field %3',Field."Field Caption",Field.RelationTableNo,Field.RelationFieldNo);
...
Field : Record 2000000041
If you read previous messages, you can see, that Tab. Field is not solution... 8)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions