Text to Option

sarmigsarmig Member Posts: 89
Hello.

I was wandering if there's a way to convert text into option

I already tried the EVALUATE function but it didn't work...

Thanks in advance

Comments

  • vaprogvaprog Member Posts: 1,139
    sarmig wrote:
    I already tried the EVALUATE function but it didn't work...
    So I suggest you try again. It is definitely the way to go.
    IF NOT EVALUATE("Document Type",DocumentTypeText) THEN
      MESSAGE('Type is invalid!');
    
    The text you feed to EVALUATE may be anything you can enter in an option control on a form.
  • sarmigsarmig Member Posts: 89
    Like this:
    RecItem.RESET;
    RecItem.SETRANGE("No.", "No. Equipamento");
    IF RecItem.FINDFIRST THEN BEGIN
      IF CONFIRM('Será introduzido este dado na ficha do Equipamento. Pretende continuar?') THEN BEGIN
        IF EVALUATE(Placa, vPlaca) THEN
        RecItem."Tipo Placa" := Rec.Placa::vPlaca;
        RecItem.MODIFY;
      END
    END;
    

    The text I want to input in the option field (Tipo Placa) in the Item table is in the variable vPlaca...
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    try this example

    Test := 'Purchase';
    EVALUATE(OptionText,Test);
    Message('Text : %1',Test);
    Message('Option : %1',OptionText);

    Where optiontext is a option type variable with option " ,Sales,Purchase,Transfer"
  • SogSog Member Posts: 1,023
    and please don't use:
    IF CONFIRM('Será introduzido este dado na ficha do Equipamento. Pretende continuar?') THEN BEGIN
    
    but instead use
    Textconstants
    txtQ := PTG="Será introduzido este dado na ficha do Equipamento.";enu="This data will be introduced in the form of equipment"
    txtConfirm :=  PTG='%1 Pretende continuar?'; ENU='%1 Continue?'
    code
    IF CONFIRM(strsubstno(txtconfirm,txtq)) THEN BEGIN
    OR
    IF CONFIRM(txtconfirm,true,txtq) then begin
    
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • sarmigsarmig Member Posts: 89
    Thanks!

    I got it!

    Here's the final version:
    RecItem.RESET;
    RecItem.SETRANGE("No.", "No. Equipamento");
    IF RecItem.FINDFIRST THEN BEGIN
      IF CONFIRM('Será introduzido este dado na ficha do Equipamento. Pretende continuar?') THEN BEGIN
         IF EVALUATE(RecItem."Tipo Placa", vPlaca) THEN BEGIN
            RecItem.MODIFY;
         END;
      END;
    END;
    
Sign In or Register to comment.