How to get field value from VARIANT variable of type record

pedroccda
Member Posts: 90
I'm trying to obtain fields' value from a variable of type VARIANT of which I know the table ID (the type of record)...but I don't want to declare many variables (one for each type of record in Navision) and then use EVALUATE [-X
I want to write flexible code, that can manage any type of record and read fields values (at least text, integer, decimal and bool )
Is it possible in some other way? And how? #-o
I tried also to use FORMAT(variantVar) and use fileds length and offset to get values but it seems not to work.... I get values but the offset is not correct...
Please help me!!!!!!!! ](*,) ](*,)
I want to write flexible code, that can manage any type of record and read fields values (at least text, integer, decimal and bool )
Is it possible in some other way? And how? #-o
I tried also to use FORMAT(variantVar) and use fileds length and offset to get values but it seems not to work.... I get values but the offset is not correct...
Please help me!!!!!!!! ](*,) ](*,)
Kiki
0
Comments
-
-
Mark Brummel wrote:Have you tried using RecordRef for this?
Yes but the problem is that I have not these record in the database... :-k
I want t use the data online of the Rec variable, check these data. If all mandatory fields (listed in a configuration table) are filled in then I'll insert the record in the database otherwise I'll give an error message.Kiki0 -
pedroccda wrote:Mark Brummel wrote:Have you tried using RecordRef for this?
Yes but the problem is that I have not these record in the database... :-k
I want t use the data online of the Rec variable, check these data. If all mandatory fields (listed in a configuration table) are filled in then I'll insert the record in the database otherwise I'll give an error message.
There is no reason not to use RecordRef, even if record is not inserted in database. Use RecordRef.GetTable([Record of any TableID]) (as far as I remember)...0 -
You can use variant as a paramater like this, if record reference cannot be used.
testtable(variant,tableID);
if TableID = 27 then begin
ItemRec := variant;
if ItemRec."No." = '' then
exit('Item No is required');
end;0 -
I don't have access to Navision right now, so I can't check this right now, but check out the methods/properties of a variant type variable. Create a variant variable, open the object browser (F5) and click the right arrow on your variant variable. There is for instance a method called ISTEXT, and when that returns true, you can put the value into a text variable. There are more methods available there.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