[SOLVED] Alternative to $valrep and drop-down list

Author: jroberson@canberra.com (Joanne Roberson)

We build a drop-down list based on current data in what we call a "lookup / setup" table. When we retrieve data with this drop-down list, if an entry has since been removed from the "lookup / setup" table, it appears as a blank value to the end-user. Should we be using a drop-down list or a different type of widget?  We want the end-user to see their data, but we don't want them to be able to select value that is no longer current? Example Lookup                                   Customer Data Monday                                              Monday Tuesday                                             NULL                            (Wednesday) Thursday                                            Thursday   We want them to see "Wednesday", but it is not a valid option for selection. Thanks for any insight in how one might accomplish this.


  1. Hi Joanne, IMHO you have two choices: 1) Do NOT let the user delete a record in your lookup/setup table when that specific value was already used in the main table 2) Let the user delete a record in your lookup/setup table but save into your main table also the related description when creating the occurrence in the main table In #1 your issue is automagically solved. In #2 when your application in a later stage retrieve data from main table it can check for each record the status of your relationship between the main table and the lookup table: - when NOT anymore valid you can load your $valrep from data saved in the main table - when still valid you can load your $valrep from lookup/setup table as usual Hope it helps... Gianni

    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  2. Hi Joanne I undestand your problem, that your VR (ValueRepresentation) list is fix at compile time. And that at runtime, a few of this values does not exists anymore. Am I right? So my soultion would by: Create  a variable with the VR as UIL (UnifaceItemList) and fill this with your constant values $VR$="" putitem/id $VR$,"MON","Monday" putitem/id $VR$,"TUE","Tuesday" putitem/id $VR$,"WED","Wednesday" and so on ... Before you display the dropdownlist just do a quick retrieve of your "setup"-table For every ID not found in your table, change the value in $VR$ to "(%%value%%%)" e.g.  putitem/id $VR$,"WED","(Wednesday)" (or by variable and string substitution) Now your customer sees does see all entries but those who are not selectable with brackets around. First part done Open the ValueChangeTrigger of your DropDownBox-field (say fieldname.atable)   $01=$item(fieldname.atable,$VR$)   IF($01[1:1]="(") RETURN(-9999) Second part done :-) If you don't want two show brackets or other extra characters, you can hold a second variable $VR_AVL$ as UIL $VR_AVL$="" putitem/id $VR_AVL$,"MON",1 putitem/id $VR_AVL$,"TUE",1 putitem/id $VR_AVL$,"WED",0 ... Where the value is 1 if the item is availble or 0 if not  <VLC>-Trigger   $01=$item(fieldname.atable,$VR_AVL$)   IF(!$01) RETURN(-9999) Ingo

    Author: istiller (i2stiller@gmx.de)
  3. Thank you both for your ideas!  I think Ingo's will work for our current situation.

    Author: Joanne Roberson (jroberson@canberra.com)