What is the best way to this?

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

What is the best way to this?

Postby Rene van Veen » Fri Jan 13, 2012 12:35 pm

We having the following thing in Servoy, i hope we can get some advice about how to do this:

A user has the ability to switch between different locations.

A product has a table with data which is the same for all the locations and also several subtables related to it with data which can be different depending on the location.
When a user adds a new product, a record should be created in all the subtables with information for all locations.
After that, the user can also add data in the subtables, that are specific for each location.
(For example, we have a product table and a supplier subtable. When adding a new product, a record is created in the supplier table, with data for all the locations.
After that, you can add more records in the supplier table, which are specific for each location.)

When selecting location A (which has it’s own specific data in a subtable), only this record should be displayed. Not the record which contains the data for all locations.
When selecting location B (which has no specific data in a subtable), the record for all locations should be displayed.

Some forms contains over 10 fields from different subtables to show in the detailform.

Then we have also the following that in some casses we have a tabpanel where we need to show the location specific data and the data what is for all locations together.

What is the best way to do this in Servoy?
Rene van Veen
Distri Data - http://www.distridata.nl
Rene van Veen
 
Posts: 8
Joined: Fri Sep 19, 2008 1:55 pm
Location: Nieuwegein

Re: What is the best way to this?

Postby Ruben79 » Fri Jan 13, 2012 3:40 pm

I hope I understand right :wink:

Maybe you can store the current location ID in a global variable and use it in your relations to each subtable to determine the right record containing that location ID.
For the 'all locations' record, you can set the location ID in your subtables records to null and use a relation that uses a global var which is null.

On your detail form, create a headless tabpanel for each such related record with 2 tabs, 1 for each relation above.
Then onShow/onRecordSelection you can find out if there are any location specific records jump to the corresponding tab with tabIndex.

And when you need to display an extra tab, just create two subtabs in it, one for the relation with the current location ID and one for the null location ID (all locations).
Ruben de Jong
Stb Software Development
SAN Partner

Stb Software Development - http://www.stb.nl
User avatar
Ruben79
 
Posts: 97
Joined: Wed Apr 18, 2007 12:43 pm

Re: What is the best way to this?

Postby Rene van Veen » Mon Jan 16, 2012 9:10 am

Thats also a good solution :) , the only thing is that there are a lot of if/else on the onShow/onRecordSelection to find out what tab to show.
Rene van Veen
Distri Data - http://www.distridata.nl
Rene van Veen
 
Posts: 8
Joined: Fri Sep 19, 2008 1:55 pm
Location: Nieuwegein

Re: What is the best way to this?

Postby Karel Broer » Mon Jan 16, 2012 9:31 am

Because -I understood from earlier conversations- you don't browse through records much, I'dd suggest to build your form content on-the-fly using SOM.
You do have a data-dictionary in the framework, so why not using it, right? :wink:
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Re: What is the best way to this?

Postby mboegem » Tue Jan 17, 2012 10:48 am

why not use the foundsetfilter(s)?

you can add/remove them on the fly, so in cases where you just need the location specific data, add the filter to the foundset and if you need all data remove it again.
I've used this many times and never failed...
Great thing is: it works also in findmode & there's no extra work involved creating new relations...

Even if you try to load a set of records - containing records from outside the filtered set - onto a form that's filtered, Servoy will correct it and just show the correct records.

Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1750
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam


Return to How To

Who is online

Users browsing this forum: No registered users and 10 guests

cron