Limiting what is seen in a ListBox Lookup

Questions and Answers about DataEase for Windows

Limiting what is seen in a ListBox Lookup

Postby robb » Thu Mar 31, 2011 8:07 am

I have a number of listboxes that are lookups of fields in other forms. When they brings in data they will bring in say 40 items, however there may only be 4 or 5 of those items that are distinct items (each distinct item is there multiple times). Is there any way of just getting the distinct items rather than having multiples of them? Also can you get them in alphabetic order?
robb
 
Posts: 45
Joined: Thu Jan 07, 2010 9:20 am
Has thanked: 0 time
Been thanked: 0 time
 

Re: Limiting what is seen in a ListBox Lookup

Postby Adrian Jones » Thu Mar 31, 2011 8:57 am

I take it you mean a multibox (and DE7)...

1: If you want distinct values, you will need to look up to a table that only has those values, unless...

Well, let's assume you are entering addresses, and you don't have a separate table for cities. So you are trying to look up existing cities from this table, but don't want them repeating.

You could add a field called something like CityFirstEnteredYN to the Address table. Create a relationship between Address and itself based on City = City, & call it 'SameCity'. Then CityFirstEnteredYN's derivation would be something like 'if ( any SameCity City = blank , "Yes" , "No" )'. The idea being that the first time you enter a specific city, is 'yes', and all other times it is 'no'.

Then make the lookup to your list of cities based on a relationship that matches on this field as well.

You'll have to assess this idea for any performance issues (and maybe resort to a single indexed field for the relationship rather than two). You will probably also have to add to the app's maintenance routines something that deals with what happens when you delete an address where CityFirstEnteredYN = yes.

Or create a posting routine that extracts the unique values, as per my first suggestion.

2. Sorting -- I'm so out of touch with DE7, but a quick look indicates that you can't sort the multibox (unlike Ffenics, where you can). So maybe your stuck with having a table of city names -- you could then cluster the data to sort it.
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 
 

Return to DataEase for Windows

Who is online

Users browsing this forum: No registered users and 2 guests

cron