Skip to main content
amritjyotiv3475
December 3, 2021
Question

How to hide custom picker field and display a textbox for creating new record when there is no matching data in selection

  • December 3, 2021
  • 4 replies
  • 0 views

How to hide custom picker field and display a textbox for creating new record when there is no matching data available in custom picker in selection coming from DB & Vice-versa.

Can anyone help me out for this logic??

    4 replies

    mikes0011
    Brainy
    December 3, 2021

    There are no ways to do this automatically within a custom picker, but about a thousand ways to handle it slightly more manually.  Such as, a button next to it that says "click here if no results are found..." or something else along those lines.

    The Expression Guru
    amritjyotiv3475
    December 3, 2021

    Thanks [mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05]

    csteward
    December 3, 2021

    One note to add here is that how I sometimes implement this is by appending the search itself to the custom picker datasubset, so that if it is not present, it can still be selected within the same picker.  Downstream logic can identify if this entry is new or not.

    This snippet is from a Meeting Minutes app I have where meetings are linked by topic, if a new topic is being added it can be done via the same custom picker even if no related meetings are present:

    
    /* local!data from a!queryEntity().data */
    
      local!topics: append(property(local!data,"topic",null),ri!search),
      
      local!distinctTopics: reject(fn!isnull,rule!APN_distinct(local!topics)),
      local!top10: index(local!distinctTopics,enumerate(min(10,length(local!distinctTopics)))+1,null),
      a!dataSubset(
        startIndex: 1,
        batchSize: 10,
        totalCount: length(local!distinctTopics),
        data: local!top10,
        identifiers: local!top10
      )

    mikes0011
    Brainy
    December 3, 2021

    By that same logic I suppose you could hard-code a selection along the lines of "<New Entry>" to always appear along with search options, and if that one is selected, trigger additonal on-form logic to type in text/etc (allowing for additional instructions and/or validations perhaps).  Honestly I haven't messed with this very much, other than a reusable component I made a long time ago to replace a people picker box with a people-from-DB-table picker (allowing even deactivated usernames to be chosen).

    The Expression Guru