Forum Discussion

BrianDunk's avatar
BrianDunk
Qrew Cadet
3 days ago

Limiting the Ability to add Child Records Based on Drop Down Field Value

I have a two table application and was wondering if there is a way to limit the amount of Child Records that can be added based on the selection of a Drop Down field?  

When a user opens the form the first thing they are asked is the level of a dealer.  Once that vaue is selected is it possible to have a rule that says if dealer level field is say "Gold" "X" amount of child records can be added.  Once that limit is met a message is diplayed telling the user the max amount of records has been met or the "Add Another Record" button goes inactive.

2 Replies

  • Thanks Mark,  couple questions.  My two tables are as follows..."Dealers" (Parent Table) has  many "Picks" (Child Table).  Which table will contain the [# of Allowed Children] field?

    In the relationship where does the Summary field go?  The "Dealers" table or the "Picks" table?

    When creating the Summary field how is the following setup?

     

  • np,

    You actually have a two-part Question.

    The first is to have a field that calculates the allowable number of child records. call it say, [# of Allowed Children]

    Case([Dealer Level],

    "Gold",3,

    "Silver",2,

    "Bronze",1,0)

    Then you make a summary field on the relationship that counts the number of children.

    The for the add button that you want to suppress, you do something like this

    vat text ADDButton = 

    URLRoot() & "db/" & [_DBID_CHILD_TABLE_NAME] & "?a=API_GenAddRecordForm&_fid_11=" & URLEncode ([Record ID#])
    & "&z=" & Rurl();

     

    iIF([# of Children] < [# of Allowed Children], $ADDButton)

    Then if you want to have a message display, you can make a rich text formula field like

    IF([# of Children] >= [# of Allowed Children], "<font color=blue><b>Max Children created") and add it to the form.  Maybe have a form rule to hide it if it's blank.