I want that if user select option 1 do some action and user select option 2 other action to happen how can i achieve this .I tried this code but I am confused.
field(MyOptionField; Option)
{
Caption = 'My Option Field';
OptionValues = OptionValues::Option1..OptionValues::Option3;
trigger OnValidate()
var
MyOption: Option;
begin
MyOption := this.Value;
case MyOption of
OptionValues::Option1:
// Do something if Option 1 is selected
// ...
OptionValues::Option2:
// Do something if Option 2 is selected
// ...
OptionValues::Option3:
// Do something if Option 3 is selected
// ...
end;
end;
}
This is not working.
yes u r right.Here,I am not understanding syntax to do so.I did this on page level but it is didnt work out
field("Level-01_Descrption";Rec."Level-01_Descrption")
{
trigger OnValidate()
var
OptionsVar: Enum CashflowLevel1Description;
Level : Enum CashflowLevel2Description;
begin
case OptionsVar OF
OptionsVar::"Cash Inflow":
begin
Rec."Level-02_Descrption":= ;
end;
OptionsVar::"Cash Outflow":
begin
Rec."Level-02_Descrption":= ;
end;
end;
end;
}
field("Level-02_Code"; Rec."Level-02_Code")
{
}
field("Level-02_Descrption";Rec."Level-02_Descrption")
{
}
Hi,
If I understand correctly, you want to set different enums in other fields based on the option selected in your first field. For example, if 'cashInflow' is selected in your first enum field, then you want to set a specific enum with three options in your second field. If 'cashoutflow' is selected, then another set of three option fields should be set in the second field. If this is the case, then your code is not correct and I also recommend you to do it on the page level and using a variable as the field on the page..
Please let me know if you need any help..
Regards
I want that If i select cashInflow ,3 Options in form of dropdown should come from a whole set of Enum should appear in another field and if i select outflow another 3 should Appear from same set.how can i achieve this.
field(2; "Level-01_Descrption"; Enum CashflowLevel1Description)
{
Editable = false;
trigger OnValidate()
var
OptionsVar: Enum CashflowLevel1Description;
begin
OptionsVar := "Level-01_Descrption";
case OptionsVar OF
OptionsVar::"Cash Inflow":
begin
"Level-02_Descrption":= "Level-02_Descrption":: ???????????????
end;
OptionsVar::"Cash Outflow":
begin
"Level-02_Descrption":= "Level-02_Descrption":: ????????????
end;
end;
end;
}
field(3; "Level-02_Code"; Enum CashFlowLevel2Code)
{
}
field(4; "Level-02_Descrption"; Enum CashflowLevel2Description)
{
}
You can try as per below
var
OptionVar: Option "A","B","C";
begin
case OptionVar OF
OptionVar::A:
begin
end;
OptionVar::B:
begin
end;
end;
end;
You can use the below code(FORMAT) ,
Here Select Type is the field name of the type Option and Withdraw, Renew are values.
Call this procedure in trigger OnValidate of Option & try giving a message in place of code.
procedure SelectOption()
begin
case "Select Type" OF
rec."Select Type"::Withdraw:
begin
// code
end;
case "Select Type" of
rec."Select Type"::Renew:
begin
//code
end;
end;
Please let me know.
Hope this Helps.
I am not getting how to get the value of the option that user selects.
You can try with Case..End statement with below link
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156