Filter Option values in Form

Hi :)

I have a form with a text box of type Option, and it has values in the OptionString property ; <Senior Manager, Manager, Senior Partner, Partner>
Is it possible to filter these depending on a criteria?

Thanks,
Y_1716

Best Answer

Answers

  • RockWithNAVRockWithNAV Member Posts: 1,139
    Hey Y_1716,

    Can you elaborate your question a bit more please.
  • DuikmeesterDuikmeester Member Posts: 308
    VarOption := Senior Manager,Manager,Senior Partner,Partner
    TextBox50000.SourceExpr := VarOption
    <TextBox50000> - OnAfterValidate()
    SETRANGE("My Field",VarOption);
    
  • swpoloswpolo Member Posts: 80
    Hi,
    Press Filter field button or F7 while cursor on this field and filter.
    This is standard Nav functionality.
    Nav Upgrades and DEV outsourcing
    Reports transformation to RDLC
    List -1h , Complex List -3h, Document -4h (dev hours)
    navisionupgrade.com
  • Y_1716Y_1716 Member Posts: 11
    Hey Y_1716,

    Can you elaborate your question a bit more please.

    Hi RockWithNAV,
    I would like to set a criteria that if that is satisfied, not all 4 options of the option string are displayed (for example display only <Senior Manager, Senior Partner> )

    thanks :)
  • DuikmeesterDuikmeester Member Posts: 308
    Filtering the options in a field itself is not possible.
  • mdPartnerNLmdPartnerNL Member Posts: 802
    Filtering the options in a field itself is not possible.
    is correct.

    But you can create a copy of the field with Senior Manager,,, Senior Partner,, and then do some extra coding

  • RockWithNAVRockWithNAV Member Posts: 1,139
    Hey Y_1716,

    As I understood you have a 3 4 different option in a Option Data Type field or Variable. What you want is on to some certain condition you want only selected option type to be visible when user clicks the Option Type Field. If this is the requirement then I will say you cant handle this with a Option data type but instead if you will handle this with lookups then I believe you can achieve what you want.
  • Y_1716Y_1716 Member Posts: 11
    Hey Y_1716,

    but instead if you will handle this with lookups then I believe you can achieve what you want.

    Hi rockWithNAV,
    then is it possible to lookup a list and set default filters on that list? Cause I'm not sure how this can be done.
    Thanks, Y_1716.

  • AntidotEAntidotE Member Posts: 61
    Hello
    I would advice you to create couple textboxes with different sets of data and turn visibility of one of them depending on your requirements.
    I can afford following example using table 37 and ruling available Type options depending on Document Type value
    for Quote - empty, G/L Acoount and Item
    for Order - empty, Resource and Fixed Asset
    for Invoice/Credit Memo - empty, Charge (Item), Title and Begin-total
    for Blanket/Return Order - empty, End-total and New page

    as a result you can move all Type controls (Type1, Type2, Type3, Type4) into the same place and user will no notice difference. I did not overlap them because of clarity of experiment result.
    OBJECT Form 59996 Test Options Availavility
    {
      OBJECT-PROPERTIES
      {
        Date=04/18/16;
        Time=[ 6:37:24 PM];
        Modified=Yes;
        Version List=Test;
      }
      PROPERTIES
      {
        Width=9790;
        Height=6490;
        SourceTable=Table37;
        OnAfterGetRecord=BEGIN
                           CheckDocType;
                         END;
    
      }
      CONTROLS
      {
        { 6000000;TabControl;220  ;220  ;9350 ;5280 ;HorzGlue=Both;
                                                     VertGlue=Both;
                                                     PageNamesML=ENU=General }
        { 6000001;TextBox   ;3850 ;990  ;2750 ;440  ;ParentControl=6000000;
                                                     InPage=0;
                                                     SourceExpr="Document Type" }
        { 6000002;Label     ;440  ;990  ;3300 ;440  ;ParentControl=6000001 }
        { 6000003;TextBox   ;3850 ;1540 ;2750 ;440  ;ParentControl=6000000;
                                                     InPage=0;
                                                     SourceExpr="Document No." }
        { 6000004;Label     ;440  ;1540 ;3300 ;440  ;ParentControl=6000003 }
        { 6000005;TextBox   ;3850 ;2090 ;1700 ;440  ;ParentControl=6000000;
                                                     InPage=0;
                                                     SourceExpr="Line No." }
        { 6000006;Label     ;440  ;2090 ;3300 ;440  ;ParentControl=6000005 }
        { 6000007;TextBox   ;3850 ;2640 ;2750 ;440  ;Name=Type1;
                                                     ParentControl=6000000;
                                                     InPage=0;
                                                     CaptionML=ENU=Type;
                                                     SourceExpr=Type1;
                                                     OnAfterValidate=BEGIN
                                                                       Type := Type1;
                                                                     END;
                                                                      }
        { 6000008;Label     ;440  ;2640 ;3300 ;440  ;ParentControl=6000007 }
        { 6000009;TextBox   ;3850 ;4840 ;2750 ;440  ;ParentControl=6000000;
                                                     InPage=0;
                                                     SourceExpr="No." }
        { 6000010;Label     ;440  ;4840 ;3300 ;440  ;ParentControl=6000009 }
        { 6000012;TextBox   ;3850 ;3190 ;2750 ;440  ;Name=Type2;
                                                     ParentControl=6000000;
                                                     InPage=0;
                                                     CaptionML=ENU=Type;
                                                     SourceExpr=Type2;
                                                     OnAfterValidate=BEGIN
                                                                       Type := Type2 + 2;
                                                                     END;
                                                                      }
        { 6000013;Label     ;440  ;3190 ;3300 ;440  ;ParentControl=6000012 }
        { 6000014;TextBox   ;3850 ;3740 ;2750 ;440  ;Name=Type3;
                                                     ParentControl=6000000;
                                                     InPage=0;
                                                     CaptionML=ENU=Type;
                                                     SourceExpr=Type3;
                                                     OnAfterValidate=BEGIN
                                                                       Type := Type3 + 4;
                                                                     END;
                                                                      }
        { 6000015;Label     ;440  ;3740 ;3300 ;440  ;ParentControl=6000014 }
        { 6000016;TextBox   ;3850 ;4290 ;2750 ;440  ;Name=Type4;
                                                     ParentControl=6000000;
                                                     InPage=0;
                                                     CaptionML=ENU=Type;
                                                     SourceExpr=Type4;
                                                     OnAfterValidate=BEGIN
                                                                       Type := Type2 + 7;
                                                                     END;
                                                                      }
        { 6000017;Label     ;440  ;4290 ;3300 ;440  ;ParentControl=6000016 }
        { 6000011;CommandButton;7370;5720;2200;550  ;HorzGlue=Right;
                                                     VertGlue=Bottom;
                                                     PushAction=FormHelp }
      }
      CODE
      {
        VAR
          Type1@6000000 : ' ,G/L Account,Item';
          Type2@6000001 : ' ,Resource,Fixed Asset';
          Type3@6000002 : ' ,Charge (Item),Title,Begin-Total';
          Type4@6000003 : ' ,End-Total,New Page';
    
        PROCEDURE CheckDocType@6000001();
        BEGIN
          CASE TRUE OF
            "Document Type" IN ["Document Type"::Quote]:
              BEGIN
                CurrForm.Type1.VISIBLE := TRUE;
                CurrForm.Type2.VISIBLE := FALSE;
                CurrForm.Type3.VISIBLE := FALSE;
                CurrForm.Type4.VISIBLE := FALSE;
                IF Type IN [Type::" "..Type::Item] THEN
                  Type1 := Type
                ELSE
                  Type1 := 0;
              END;
            "Document Type" IN ["Document Type"::Order]:
              BEGIN
                CurrForm.Type1.VISIBLE := FALSE;
                CurrForm.Type2.VISIBLE := TRUE;
                CurrForm.Type3.VISIBLE := FALSE;
                CurrForm.Type4.VISIBLE := FALSE;
                IF Type IN [Type::Resource..Type::"Fixed Asset"] THEN
                  Type2 := Type - 2
                ELSE
                  Type2 := 0;
              END;
            "Document Type" IN ["Document Type"::Invoice,"Document Type"::"Credit Memo"]:
              BEGIN
                CurrForm.Type1.VISIBLE := FALSE;
                CurrForm.Type2.VISIBLE := FALSE;
                CurrForm.Type3.VISIBLE := TRUE;
                CurrForm.Type4.VISIBLE := FALSE;
                IF Type IN [Type::"Charge (Item)"..Type::"Begin-Total"] THEN
                  Type3 := Type - 4
                ELSE
                  Type3 := 0;
              END;
            "Document Type" IN ["Document Type"::"Blanket Order","Document Type"::"Return Order"]:
              BEGIN
                CurrForm.Type1.VISIBLE := FALSE;
                CurrForm.Type2.VISIBLE := FALSE;
                CurrForm.Type3.VISIBLE := FALSE;
                CurrForm.Type4.VISIBLE := TRUE;
                IF Type IN [Type::"End-Total"..Type::"New Page"] THEN
                  Type4 := Type - 7
                ELSE
                  Type4 := 0;
              END;
          END;
        END;
    
        BEGIN
        {
          each Type has empty value in case of incorrect available.
    
          Type1:
          0
          1 G/L Account
          2 Item
          Type2 (+2):
          3 Resource
          4 Fixed Asset
          Type3 (+4):
          5 Charge (Item)
          6 Title
          7 Begin-Total
          Type4 (+7):
          8 End-Total
          9 New Page
        }
        END.
      }
    }
    
    It is hard to swim against self bloodstream... (c) Old, experienced kamikadze.
Sign In or Register to comment.