Options

Returning optionstring from Fieldref

timetime Member Posts: 8
Hi,
i´m having problems getting the option string from a fieldref variable.

text := FORMAT(Fieldref_lr.VALUE,0,'<Text>');
Always returns just integer value from the option field.

Any ideas ?

Comments

  • Options
    fbfb Member Posts: 246
    The following comment is listed in the (v4.0) on-line C/SIDE help topic on FieldRef.VALUE:
    If you want to format the value of a fieldref you must use:

    FORMAT(FieldRef)

    instead of

    FORMAT(FieldRef.VALUE)
  • Options
    timetime Member Posts: 8
    When I call
    t := Format(Fieldref_lr);
    it crashes Navision.


    I fixed the 'easy' way.

    GetOptionString(AllValues : Text[1024];SelectedValue : Integer) : Text[50]

    i := STRPOS(AllValues,',');
    iPlace := 1;
    WHILE i>0 DO BEGIN
    arValues[iplace] := COPYSTR(AllValues,1,i-1);
    AllValues := COPYSTR(AllValues,i+1);
    iPlace+=1;
    i := STRPOS(AllValues,',');
    END;
    arValues[iplace] := AllValues;
    EXIT(arValues[SelectedValue]);

    Then I call
    t := GetOptionString(Fieldref.OptionCaption,iSelectedVal);
  • Options
    timetime Member Posts: 8
    Fix for posted code.

    GetOptionString(AllValues : Text[1024];SelectedValue : Integer) : Text[50]

    i := STRPOS(AllValues,',');
    iPlace := 1;
    WHILE i>0 DO BEGIN
    arValues[iplace] := COPYSTR(AllValues,1,i-1);
    AllValues := COPYSTR(AllValues,i+1);
    iPlace+=1;
    i := STRPOS(AllValues,',');
    END;
    arValues[iplace] := AllValues;
    //EXIT(arValues[SelectedValue]);

    EXIT(arValues[SelectedValue+1]); //Should be this of course :)
Sign In or Register to comment.