Can't assign an option value

law
law Member Posts: 19
In a table there's an optin field with optionstring=Vállalat,Vevő,Szállító.
I made a function like this:
function LookupSite(PartnerType: 'Vállalat,Vevő,Szállító');
begin
  do something with PartnerType...
end;

I call this function like this:
var variable:'Vállalat,Vevő,Szállító';
begin
  variable:=Rec.Type;
  LookupSite(variable);
end;

Rec.Type is is an Option field Vállalat,Vevő,Szállító.
If Rec.Type=Vevő, then variable's value will be Vállalat. If Rec.Type=Szállító, then variable's value will be Vevő.

What am I doing wrong?

Comments

  • Arhontis
    Arhontis Member Posts: 667
    Hi,

    Try for dubugging purposes to give 2 parameters, the one you already have and a second, integer type. Pass the same values to your routine, like this:
    function LookupSite(PartnerType: 'Vállalat,Vevő,Szállító';PartnerType2:integer); 
    begin 
      message('param1='+Format(PartnerType)+' param2='+Format(PartnerType2));
      do something with PartnerType... 
    end; 
    
    I call this function like this: 
    var variable:'Vállalat,Vevő,Szállító'; 
    begin 
      variable:=Rec.Type; 
      LookupSite(variable,variable); 
    end; 
    
    and see what the message shows...
    Is it param1=param2?

    Option type is in fact integer type... so you can use an integer parameter.
  • pdj
    pdj Member Posts: 643
    Rec.Type is is an Option field Vállalat,Vevő,Szállító.
    Are you sure it isnt ",Vállalat,Vevő,Szállító"?

    The initial comma makes the first option (no. 0) blank, but if there isn't a blank char before the comma you wont see it when showing the field on forms. Have you looked at the OptionStr property of the field?
    Regards
    Peter