A possible bug for firing the global method of value list

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

A possible bug for firing the global method of value list

Postby herakles86 » Tue Nov 18, 2014 6:07 am

Hi, guys, I met a problem when I developing a servoy solution.

I create a combobox which has a dataprovider with a deep chain of relation like a_to_b.b_to_c.c_to_d.id, and its value list is generated by a global method.
If the form is first time shown and at the same time, the selected record doesn't have foreign value, then the global method of value list in that combobox will not fire.

I attached a sample solution to reproduce this bug.
There are four table, a, b, c and d.
a has pk a_id, b_id and a field a_field,
b has pk b_id, c_id,
c has pk c_id, d_id,
d has pk d_id and a field displayvalue

a's b_id and b's pk b_id are linked through the relation a_to_b
b's c_id and c's pk c_id are linked through the relation b_to_c
c's d_id and d's pk d_id are linked through the relation c_to_d

the form's datasource is a, and it has two fields.
one is text field to display the foudset field, and another is a combobox with the dataprovider: a_to_b.b_to_c.c_to_d.d_id. The value list of combo is generated from a global method, the global method will return a value list according to the table d. the real value is the pk of table d, and display value is the 'displayvalue' field of table d.

table a has three records, one does not have any foreign value, but other two both have a full foreign value to table d.
after running the sample solution, u can find that, when first time the form is shown, if the selected record is the one that hasn't foreign value, then the global method of combobox will not fire.
but when one of other two records is selected, because they have full foreign value to the table d, the global method will fire properly.

Did someone meet this issue before? How to tackle it? Perhaps, there is another better way to avoid this issue?
I am looking forward for your kind reply. Thank you guys.
Attachments
Bug4DeepRealtionFireGlobalValuelistMethod.servoy
(6.45 KiB) Downloaded 227 times
Anping Wang

TSM (The Service Manager)
Australia
herakles86
 
Posts: 14
Joined: Mon Aug 25, 2014 1:30 am

Re: A possible bug for firing the global method of value lis

Postby jcompagner » Mon Nov 24, 2014 3:16 pm

please make a case with that example in our support system then we can have a look
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: A possible bug for firing the global method of value lis

Postby john.allen » Thu Nov 27, 2014 12:15 am

I guess I am missing something. Why would that global method fire at all if there are no related child and grandchild records in b and c first? I can see that one might want a record to be created programmatically in d if at the very least the relations a_to_b and b_to_c are there. But if the b/c related records are not there at all then the dataprovider a_to_b.b_to_c.c_to_d.d_id isn't there and how/why would you want to create a record in d without those records first? That's an orphan which you might want but not via form with datasource a, no?
John Allen
Stanford University
john.allen
 
Posts: 515
Joined: Wed Jul 02, 2003 10:07 pm
Location: Stanford CA USA

Re: A possible bug for firing the global method of value lis

Postby maria.kyselova » Thu Nov 27, 2014 4:21 am

john.allen wrote:I guess I am missing something. Why would that global method fire at all if there are no related child and grandchild records in b and c first? I can see that one might want a record to be created programmatically in d if at the very least the relations a_to_b and b_to_c are there. But if the b/c related records are not there at all then the dataprovider a_to_b.b_to_c.c_to_d.d_id isn't there and how/why would you want to create a record in d without those records first? That's an orphan which you might want but not via form with datasource a, no?


Hi John,

I have a screen with company information. One section in it displays the company primary contact.
A new contact record is created when I click in any of the contact form fields. That is the point in time when I need to pick a value from my combobox (which is not available).

Contacts have a many-to-many relationship to companies.
A many-to-many relationship will not be seen by Servoy until one saves it, because you can only do company_to_company_has_contact.newRecort(), but you can't go further and execute company_to_company_has_contact.company_has_contact_to_contact.newRecord() - company_has_contact_to_contact will be undefined at that point.

So yes, I have a company record, a contact record and the linking record between them, but only the company record is saved in the database at that point (or it may not be, if the user is adding a company). So I should be able to enter whatever information I want, including that valuelist. The problem is that I cannot seem to be able to do it before I hit 'Save' on the screen. Then I have to go to the combobox with my valuelist and that's when it will fill with values. You see, how this workflow is unacceptable in the real world.

The scenario I described is simplified. In fact, my dataprovider for the valuelist in question comes from this sort of relationship: company_to_company_has_contact.company_has_contact_to_contact.contact_to_person.that_unlucky_field
So we don't only create the contact and the link between the company and contact, but also the person record.
Cheers,
Maria
maria.kyselova
 
Posts: 172
Joined: Thu Aug 09, 2012 12:56 am

Re: A possible bug for firing the global method of value lis

Postby john.allen » Thu Nov 27, 2014 6:07 pm

I guess my question would be twofold:

1) Forgetting about 'Servoy', at the state that your transaction is in and where you want the combo box to have values to choose from, can you write the SQL to get the values you want?

2) If you cannot do that then it's a different issue and your database needs to be in a different state it would seem to me. If you can do that, then the dataprovider of that combo box should be a form variable, not an actual field as it would seem the relationship is not yet there. With a form variable and the ability to write the method/SQL to give the correct values for that combo box, the user can select a value. At that point, doing a save, that record (and the relationship) can be created and the actual table field can be shown.
John Allen
Stanford University
john.allen
 
Posts: 515
Joined: Wed Jul 02, 2003 10:07 pm
Location: Stanford CA USA

Re: A possible bug for firing the global method of value lis

Postby maria.kyselova » Fri Nov 28, 2014 6:41 am

john.allen wrote:I guess my question would be twofold:

1) Forgetting about 'Servoy', at the state that your transaction is in and where you want the combo box to have values to choose from, can you write the SQL to get the values you want?

2) If you cannot do that then it's a different issue and your database needs to be in a different state it would seem to me. If you can do that, then the dataprovider of that combo box should be a form variable, not an actual field as it would seem the relationship is not yet there. With a form variable and the ability to write the method/SQL to give the correct values for that combo box, the user can select a value. At that point, doing a save, that record (and the relationship) can be created and the actual table field can be shown.


Thanks, John.
I understand your solution, but I have 50 forms in each module to manage, 53 modules in my solution, multi-window environment in smart client with full-on customisable business logic, security, intercepted event functions and intensive data activity, plus it's all in the cloud with multiple tenants and that's just off the top of my head.
I can't afford to have a dataprovider based on a local variable everywhere I may not have a related record, and a custom method on each of those fields to display a queried list of values. Maintenance is already hell and I am keeping things with single point of error and as generic/dynamic as possible :)

Servoy bug submitted. Hopefully Servoy can take care of it.
Cheers,
Maria
maria.kyselova
 
Posts: 172
Joined: Thu Aug 09, 2012 12:56 am


Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: No registered users and 5 guests