Welcome! Log In Create A New Profile

Advanced

(WB 12 Eng) How to get syncronized two combos?

Posted by Jaime Fernandez 
Jaime Fernandez
(WB 12 Eng) How to get syncronized two combos?
January 10, 2009 11:36AM
Hi,
Do you know which is the best way to get sincronized two combos(not editable & embedded query?
Is it possible to use indirections in the parameters, values or anything in the description of the query conditions?
What event do you use to perform the 2nd query?

Combo 1
Description (registry key K1 as stored value)
Combo 2
Description (select * from file where K2 = Combo1)

Thank you
Piet van Zanten
Re: (WB 12 Eng) How to get syncronized two combos?
January 10, 2009 01:04PM
Hi Friedman,

If I understand your question correctly you are talking about a master-slave relationship between two combos.
In the master combo you can use the Row Selection section of the combo code to refresh the slave combo.
ListDisplay(cmb_Combo2,taInit)
In the slave combo you can use the Initalization code to set the query parameter and (re)execute the query.
MySource.Param_K2=cmb_Combo1
ListDisplay(cmb_Combo2l,taReExecuteQuery)

Best regards,
Piet
Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 10, 2009 04:55PM
First of all, thank you Piet! You have understood rigth, but this is not a solution:
1. There is no Row Selection section on Combo code(and neither can add it, does not exist).
2. cmb_Combo1 is equal to "" in Initialization code of cmb_combo2.
3. With a Combo it is impossible to use position (tainit, tareexecutequery) because error "No syntax of ListDisplay is compatible"

4. And here is a conceptual question: If I assign cmb_Combo1(stored value) on Initialization code of Combo2, only executes one time, Am I right?. The cmb_Combo1 value must be assigned on the equivalent to "row selection" event, so How to access to embedded query to assign the param value?

Regards and thank you
Fabrice Harari
Re: (WB 12 Eng) How to get syncronized two combos?
January 10, 2009 05:45PM
Hi Firedman...

In a combo, the 'missing code' is called 'whenever modified of', which means that the user selected another line

Best regards

Piet van Zanten
Re: (WB 12 Eng) How to get syncronized two combos?
January 10, 2009 08:06PM
Sorry, Friedman, I missed the WB 12 in the subject, so I accidently replied for Windev instead of Webdev. In Windev there is a row selection code section. I'm not a Webdev user. (I found MySQL and PHP suited my purpose better)

Best regards,
Piet
Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 09:57AM
Thank you Piet.
Webdev let you to use php and mysql, theoretically without WDServer, just plain php. In fact, it is one of the reasons why I bought Webdev.
Regards
Piet van Zanten
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 10:53AM
Hi Friedman,

I used Webdev 9 and 10 only for php/mysql, but encountered too many problems, that took me too much time. Perhaps it's better in version 12, but I'm not willing to take the plunge again. I've found a great php editor with a fantastic debugger in NuSpere's PhpED.

Regards, Piet
Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 11:00AM
Hi Fabrice,

Whenever modified event it's not fired first time the combo load the content, it's fired when change the selected row so its equivalent to Piet's Row Selection, thank you.
But, I have figured out how to assign the parameter of the embedded query of combo2 in "whenever modified" of Combo1, but for the first time the page loads doesn't works because "whenever modified" is not fired, so Which event can I use for first time?

Regards
Fabrice Harari
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 12:16PM
Hi Friedman...

Clearly the modified envent is not called when initializing the combo (it's a user event, after all), so you just have to call your code ALSO from the page initialization code

Best regards

Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 01:40PM
Hi Fabrice,
After the my previous post I have tried to do that on all Initialization code (page, combo1,combo2) but the problem is that the combo1's query is not executed, so combo1 is empty. I have tried to execute the embedded query , but it is not executed: info(combo1) on Intialization Code of Page displays nothing.
Regards
Fabrice Harari
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 02:23PM
Hi Friedman...

In the page init code, in the combo init code, and in the combo END OF init code, do a trace to display what is done WHEN... Once you know that, finding where to call the nit of your second combo should be easy

best regards

Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 05:21PM
As you say, it should be easy... but I can't figured out, Combo1(stored value) returns "" in all cases, all events.
Only Page Load returns something, the selected record, but when I try via ajax to fill combo2, combo1 is "" again. sad smiley

PD: I have had a Concat in the embedded sql of combo1, because I need to use stored procedures I have changed to HF C/S, then the Initialization of the combo1 crash, GPF, I'm going crazy, I waiting to develop 10 times faster winking smiley.
When I have two elements in combo1 and change the selection, combo2 works ok.
Regards
Fabrice Harari
Re: (WB 12 Eng) How to get syncronized two combos?
January 12, 2009 07:34PM
Hi Again...

So, what is the result of the trace I asked you to do?

Regards

Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 13, 2009 12:07AM
Hi Fabrice,

The trace:
Global Declaration Page
Init Combo1
Init Combo2
End Init Combo1
End Init Combo2
Init Page

In all of these events Combo1 returns ""

Regards
Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 13, 2009 11:19AM
I have figured out, :cheers: , the crux of the matter is that Combo1 is always "" in the initialization, only when page is displayed returns something (stored value) but the embedded query is not empty after the end of initialization of Combo1, so assinging the parameter value must be done at the end of initialization of Combo2.

I hope this helps someone to save time!!
Thank you Fabrice.
Regards
Fabrice Harari
Re: (WB 12 Eng) How to get syncronized two combos?
January 13, 2009 11:55AM
Hi Friedman...

the fact that the combo returns ''" means that no line has been selected yet, which means that you can do the following:

in the page init code (the last one)
//SELECT the first line of the combo BEFORE the page would do so
ListSelect(Combo1, 1)
//Get the return value from combo1

//Reinit combo 2 with appropriate values

And to speed up the process and avoid the original init of combo2, you can also do the following:

//Block the init of combo 2 in the GLOBAL declaration of the page with:
combo2..BrowsedFile=""

//in the init of the page, in the reinit combo2 part, start with:
combo2..browsedFile="RealFileNameBetweenQUOTES"

Best regards

Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 13, 2009 01:01PM
HI Fabrice,

For me this thread is closed, my "sincronizations" works ok, anyway I have tried your last solution but doesn't works, ListSelect(Combo1,1) then info(Combo1) displays "" again.

Thank you very much Fabrice.

Regards
Fabrice Harari
Re: (WB 12 Eng) How to get syncronized two combos?
January 13, 2009 02:02PM
ooops,

sorry, it was listselectplus

But I'm happy to hear you have a working solution
Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 13, 2009 09:04PM
Jeje, thread reopen!

Yes, that's right, for all:

Simple Solution:
Combo1_End_of_Initialization
ListSelectPlus(combo1,1)

Combo2_End_of_Initialization
Mysource.paramname = Combo1
ListDisplay(Combo2)

This is the simplest solution, but Combo2's embedded query executes 2 times, one with blank param and second with Combo1, Is this right?, please confirm (about this, Has HF C/S anything like Oracle's shared pool to see the executed queries?)

To avoid the double-execution you suggest to clear BrowseFile (all code must be moved and fixed to Page Initialization code). I have tried this, but I can't reassing the embedded query:

Error at line 8 of Initialization of PAGE_Test (server) process.
Unable to initialize 'COMBO_2' control. Hyper File Error:
=============================
Query with parameters (PAGE_Test_2$Query) not run automatically. No parameter defined for this query. To automatically run the query with parameters associated with a table control, define a parameter value.
=============================
Query with parameters (PAGE_Test_2$Query) not run automatically. No parameter defined for this query. To automatically run the query with parameters associated with a table control, define a parameter value.


Line 8 = COMBO_2..BrowsedFile = "PAGE_Test_2$Query"

How can I assign a query parameter if can't assign the query?
Regards
Fabrice Harari
Re: (WB 12 Eng) How to get syncronized two combos?
January 13, 2009 10:03PM
Hi again...

try to use an independent query instead of an embedded one... I found out (and you can see many of the reason for that in Dereck's answer yesterday, I think) that embedded query are generally a pain in the ass

best regards

Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 14, 2009 09:11AM
Hi Fabrice,
Yes it is a pain in the ass, but not only embedded queries winking smiley. I read Dereck's post but conceptually I like embedded.
About question of shared pool or something to see the executed queries, do you know anything?
Regards
Jaime Fernandez
Re: (WB 12 Eng) How to get syncronized two combos?
January 21, 2009 11:07AM
To all:
Most similar, that I can find, to Oracle's shared pool in HF C/S is via HyperFile Control Center -> Configuration-> Logs option and check note the calls to server... & note the parameters...

Regards



Edited 2 time(s). Last edit at 01/22/2009 02:29PM by Friedman.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: