fieldref with type option.

sandy_bsilsandy_bsil Member Posts: 40
Hi All,
I am using fieldref to print those fields which are not blank on the report. But the problem is when the field type is option, I am not able to get the current option value selected.
For Ex.

FieldValue := FORMAT(FieldRef1.VALUE);
CaptionText := FORMAT(FieldRef1.CAPTION);
FieldType := FORMAT(FieldRef1.TYPE);

IF ((FieldType = FORMAT('Option')) THEN
IF (FORMAT(FieldRef1.VALUE) > FORMAT('0')) THEN BEGIN
DisplayText1 := CaptionText + ': ' FieldValue;
......
end;

Now this FieldValue will always have the integer value (0,1,2,...).But how to get the option value in string that is currently selected.
](*,)

regards
Sandy.
Sandeep B

Comments

  • kinekine Member Posts: 12,562
    Try to use FieldRef.OPTIONCAPTION and SELECTSTR together to get the caption for option with no. X.
      OptionCaption := SELECTSTR(MyOptionValue,FieldRef.OPTIONCAPTION);
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • sandy_bsilsandy_bsil Member Posts: 40
    kine wrote:
    Try to use FieldRef.OPTIONCAPTION and SELECTSTR together to get the caption for option with no. X.
      OptionCaption := SELECTSTR(MyOptionValue,FieldRef.OPTIONCAPTION);
    



    Thanx.. it works.. but there is some problem..

    Case 1.
    Optionvalue = 3
    OptionCaption = ,EN ISO 17292/ASME B16.34 (BS 5351),EN ISO 17292(BS-5351) & BS 6364,API-608,API 6D/ASME B16.34
    OptionStr = EN ISO 17292(BS-5351) & BS 6364

    Case 2.
    Optionvalue = 2
    OptionCaption = ,BS EN 12266 (BS 6755),API 598,ANSI 16.34,API6D,ANSI FCI 70.2
    OptionStr = API 598

    As you can see in case 1 its coming wrong but in case 2 its correct. So any idea why this is happening..

    regards
    Sandy.
    Sandeep B
  • kinekine Member Posts: 12,562
    Check the caption string on the table directly and look for empty values in it. May be they are the problems. Try to use the OptionName instead Captions...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.