Many-to-Many, once again.

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Many-to-Many, once again.

Postby JerryR » Tue Sep 07, 2004 8:49 am

I have a Jobs table with a field Job_status. Job_status can be 'Open' or 'Closed'. I would like to give a user the option to view All Jobs, All Open Jobs, or All Closed Jobs in a table view, based on selecting 'All', 'Open', or 'Closed' from a value list. For a number of reasons, I need to do this through manipulation of the left side of a relationship, rather than by doing 'Finds'. In FMP, one could stick 'Open', 'Closed', or 'Open' and 'Closed' on separate lines in a global field to form the key on the left side of a relationship to give the user this functionality. Given the lack of many-to-many keys of this sort in the SQL world, how do you do this in Servoy?
Jerry Robinson
JPR Engineering Inc
JerryR
 
Posts: 104
Joined: Sat Jan 17, 2004 4:30 am
Location: Pacific Palisades, CA

Postby Jan Aleman » Tue Sep 07, 2004 11:31 pm

Servoy is similar to other environments - you set up a global on the left side of the relation (that will hold the status "Open", "Closed", etc) and then you match it to the status on the right side.

To show all - you need to hook up a method on the "onDataChange" event of the global field (formatted as a combobox) - and then perform the find you want.

Hope this helps,

Jan Aleman
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Postby JerryR » Wed Sep 08, 2004 12:45 am

Jan...Does that mean that you can have a related tab-panel and do a loadAllRecords and *change* the set of records that's being controlled by the relationship? More specifically... Customers have Jobs. The Jobs display in the tabless tab panel. The relationship is cust_sn (in custs) to cust_sn (in jobs) *and* globals.job_status (which can be set to open or closed) to jobs.job_status. How do you 'override' the presence of the global (which has to match a job status of open or closed) to get *all* records with both statii? Are you saying you can do a search and override the relationship?
Jerry Robinson
JPR Engineering Inc
JerryR
 
Posts: 104
Joined: Sat Jan 17, 2004 4:30 am
Location: Pacific Palisades, CA

Postby jcompagner » Thu Sep 09, 2004 11:52 am

All columns you specify in a relation will be used by that relation (so if you set the global to null then it will do a search on null, it will not what you want in this example delete the global from the relation if the global is null) You have to do the search youreself for that..

So in the tabbless panel you should be showing a non related tabpanel. Then the combo has a onDataChange. And in that script you do the search yourself for that panel. (looking what whas selected open, closed or all)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby JerryR » Thu Sep 09, 2004 3:19 pm

Thanks, got it!
Jerry Robinson
JPR Engineering Inc
JerryR
 
Posts: 104
Joined: Sat Jan 17, 2004 4:30 am
Location: Pacific Palisades, CA


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 29 guests