changing the tablesource of a record-var?

redStripe
Member Posts: 83
Hello,
I got a new problem...
I have a table with a col called "table.nr", in each line is different value
e.g. 23, 18 or 65
Now I want write a function that opens, line after line, the table ...
Is it possible to change the sourcetable of recordvar during the execution?
redStripe
I got a new problem...
I have a table with a col called "table.nr", in each line is different value
e.g. 23, 18 or 65
Now I want write a function that opens, line after line, the table ...
Is it possible to change the sourcetable of recordvar during the execution?
redStripe
0
Answers
-
You need to use a variable of type RecordRef. A record-variable can not be changed at run-time, to point to a different table.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Hi Luc,
thanks for your tip. if i use recordref and fieldref like thatrecordRef.OPEN("Table No."); fieldRef := recordRef.FIELD("Field No.");
how can i get the value of the field?
redStripe0 -
-
FieldRef.VALUE
doesn't work ...0 -
:? It should...
What error message do you get?
Or is it a flowfield?0 -
I get no error-message. VALUE is just empty
RecordRef.OPEN(Record."Table No."); FieldRef := RecordRef.FIELD(Record."Field No."); MESSAGE('TabNr.: %1 TabName: %2 FieldNr.: %3 FieldName.: %4 FieldValue: %5', tmpTable.NUMBER, tmpTable.NAME, tmpField.NUMBER, tmpField.NAME, tmpField.VALUE);
I get every Information but Value is empty.
Did I mistake?
redStripe0 -
The code you are posting is a bit confusing :?
What is the value of Record."Field No." ?
Why have you programmed a message with an other variable than the FieldRef?
FieldRef.VALUE returns a Variant with the value.
If it is a flowfield you should use calcfields first.0 -
sorry marc to confuse you
i edit the code for the forum and forget to rename my variable.
here is the code again:RecordRef.OPEN(Record."Table No."); FieldRef := RecordRef.FIELD(Record."Field No."); MESSAGE('TabNr.: %1 TabName: %2 FieldNr.: %3 FieldName.: %4 FieldValue: %5', RecordRef.NUMBER, RecordRef.NAME, FieldRef.NUMBER, FieldRef.NAME, FieldRef.VALUE);
>What is the value of Record."Field No." ?
The number of the field, which I want the value. e.g. 5
btw it is no flowfield.
redStripe0 -
Problem is that you have not defined a record in the RecRef.
You should eitger do a get/find or pass a record to the recordref.RecRef.GET RecRef.FIND
0 -
I have a record var ... i just renamed it, because of better understanding ..
and I also do a find a few lines above.
here ist the original code:
tmpTable = RecordRef
tmpField = FieldRefCheck_Value_Field_rec.INIT; Check_Value_Field_rec.FIND('-'); REPEAT tmpTable.OPEN(Check_Value_Field_rec."Table No."); tmpField := tmpTable.FIELD(Check_Value_Field_rec."Field No."); MESSAGE('TabNr.: %1 TabName: %2 FieldNr.: %3 FieldName.: %4 FieldValue: %5' ,tmpTable.NUMBER, tmpTable.NAME, tmpField.NUMBER, tmpField.NAME, tmpField.VALUE); UNTIL Check_Value_Field_rec.NEXT = 0;
the problem ist that I get every information of the table and the field,
but not the tmpField.VALUE0 -
Ok. This is in your code:
Check_Value_Field_rec.INIT; Check_Value_Field_rec.FIND('-'); REPEAT tmpTable.OPEN(Check_Value_Field_rec."Table No."); if tmpTable.FIND('-') then repeat tmpField := tmpTable.FIELD(Check_Value_Field_rec."Field No."); MESSAGE('TabNr.: %1 TabName: %2 FieldNr.: %3 FieldName.: %4 FieldValue: %5' ,tmpTable.NUMBER, tmpTable.NAME, tmpField.NUMBER, tmpField.NAME, tmpField.VALUE); Until tmpTable.NEXT = 0; UNTIL Check_Value_Field_rec.NEXT = 0;
Without a find or get it is the same as defining a record variable and message a fieldvariable without a get or find.0 -
thanks a lot ... now it works0
-
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