if i read your post correctly, you want to assign the value in a textvariable to an option field ? in that case there is not straghtforward assignment possible, you'll have to use a Case statement or similar construction.
an example ( using the Status field of T36 Sales Header ) :
Case Uppercase(TxtVariable) of
'OPEN' :
Salesheader.status := Salesheader.status::open ;
'RELEASED' :
Salesheader.status := Salesheader.status::released ;
End ;
if i read your post correctly, you want to assign the value in a textvariable to an option field ? in that case there is not straghtforward assignment possible, you'll have to use a Case statement or similar construction.
an example ( using the Status field of T36 Sales Header ) :
Case Uppercase(TxtVariable) of
'OPEN' :
Salesheader.status := Salesheader.status::open ;
'RELEASED' :
Salesheader.status := Salesheader.status::released ;
End ;
I wouldn't use the CASE for this, you could just use an EVALUATE...
//Op = ' ,Try,This' //Option field, the OptionString listed between single quotes.
//Txt is a text variable
Txt := 'Try';
MESSAGE(FORMAT(Op));
//Message is blank
EVALUATE(Op,Txt);
MESSAGE(FORMAT(Op));
//Message is 'Try'
Txt := 'THIS'; //Note caps
EVALUATE(Op,Txt);
MESSAGE(FORMAT(Op));
//Message is 'This'
This will cut down on a lot of code for the CASE statements.
Kevin
-Lavin "Profanity is the one language all programmers know best."
if i read your post correctly, you want to assign the value in a textvariable to an option field ? in that case there is not straghtforward assignment possible, you'll have to use a Case statement or similar construction.
an example ( using the Status field of T36 Sales Header ) :
Case Uppercase(TxtVariable) of
'OPEN' :
Salesheader.status := Salesheader.status::open ;
'RELEASED' :
Salesheader.status := Salesheader.status::released ;
End ;
I wouldn't use the CASE for this, you could just use an EVALUATE...
//Op = ' ,Try,This' //Option field, the OptionString listed between single quotes.
//Txt is a text variable
Txt := 'Try';
MESSAGE(FORMAT(Op));
//Message is blank
EVALUATE(Op,Txt);
MESSAGE(FORMAT(Op));
//Message is 'Try'
Txt := 'THIS'; //Note caps
EVALUATE(Op,Txt);
MESSAGE(FORMAT(Op));
//Message is 'This'
This will cut down on a lot of code for the CASE statements.
Kevin
True. Only works in case the text variable uses the exact wording of the option though, which is why i prefer to go for the CASE option in most cases.
Comments
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
an example ( using the Status field of T36 Sales Header ) :
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
I wouldn't use the CASE for this, you could just use an EVALUATE...
This will cut down on a lot of code for the CASE statements.
Kevin
"Profanity is the one language all programmers know best."
If you want to assign option value into text than this:
P.S.:(Klavin was faster... :-))
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Woohoo, stole it!
"Profanity is the one language all programmers know best."
Of corse you can need sometime some mapping. But in most cases it is not from "free text" value...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.