Problem with fieldref of type Option

Tbi
Member Posts: 33
Hi,
I am importing a textfile into a table and then there are some problem when I get a fieldref of type Option. (No, I cannot use dataport, its to be used in NAS).
I get an error saying : 'The expression Text cannot be Type-converted to an Option value' when I tries to set the value.
What can I do to make this work?
I am importing a textfile into a table and then there are some problem when I get a fieldref of type Option. (No, I cannot use dataport, its to be used in NAS).
I get an error saying : 'The expression Text cannot be Type-converted to an Option value' when I tries to set the value.
frFieldRef = Fieldref sValue = Text[30] iTmpInt = Integer CASE frFieldRef.TYPE OF 'Option': BEGIN IF STRPOS(UPPERCASE(frFieldRef.OPTIONCAPTION),UPPERCASE(sValue)) > 0 THEN BEGIN IF frFieldRef.OPTIONCAPTION[1] = ',' THEN BEGIN iTmpInt := 2; END ELSE BEGIN iTmpInt := 1; REPEAT iTmpInt += 1; UNTIL STRPOS(UPPERCASE(SELECTSTR(iTmpInt,frFieldRef.OPTIONCAPTION)),UPPERCASE(sValue)) = 0; END; frFieldRef.VALIDATE(SELECTSTR(iTmpInt,frFieldRef.OPTIONCAPTION)); END; END;
What can I do to make this work?
0
Comments
-
Try using the EVALUATE command instead of VALIDATE.
If you need to VALIDATE then call this after the EVALUATE.
Haven't tried it myself but I think it might workThis isn't a signature, I type this at the bottom of every message0 -
I have also tried this, but it gives me an error saying: You cannot enter 'my value' in Option. The cursor is in front of the invalid character.0
-
I'm not sure I understood the question but.....
if i remenber well, it seams that FieldRef var respect the language code of the database... so try to use 'my value in my language' instead of 'my value'....
For instance i used to have a filter the next code :FieldReference.SETFILTER(STRSUBSTNO('%1','Text filter in my language'));
and it worked......My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
In order to set the value of the option field to your input value I corrected the following line:
frFieldRef.VALIDATE(SELECTSTR(iTmpInt,frFieldRef.OPTIONCAPTION));
toEVALUATE(frFieldRef,FORMAT(iTmpInt));
as mentioned above.. If you evaluate the frfieldref.optioncaption instead of validating it one get an type error. But inserting the integer variable the code returns the correct option ..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