Populate DDDW based on the value of another DDDW


The contents of a particular drop down datawindow depends on the value of another drop down datawindow.
For example we need to filter some employees based on the team they belong to. In the current datawindow, Teams will be a drop down datawindow whose contents depend on the value of another DDDW Departments.

Will assume the datasource of the datawindow containing the two dddws, named t_filter, contains team_id and department_id columns having the generic value of 0 (where the id in both teams and departments tables start with 1).
We create two datawindows with following datasources and link properly to each dddw:

SELECT departments.id AS department_id,
departments.description AS department_description FROM departments
UNION (SELECT 0 AS department_id, '-' AS department_description FROM t_filter LIMIT 1)
SELECT teams.id AS team_id,
         teams.department_id AS department_id,
         teams.description AS team_description
	FROM teams
		WHERE teams.description_id = :adepartment_id
	(SELECT 0 AS team_id,
		0 AS department_id,
        '-' AS team_description FROM t_filter LIMIT 1)

The rest of the code will be in the filter window.
We declare a datawindowchild as instance variable. The department variable will hold the last department selection to avoid unnecessary database traffic.

DataWindowChild dwc;
int department;

When the datawindow is retrieved will have to avoid the retrieval argument request, right before the main retrieve call, in the Open() event (dw_main is the container datawindow control placed in the filter window):

dw_main.GetChild("team_id", dwc);

If the user selects a different department, the content of the teams dddw child will have to be updated. In the ItemChanged event:

if GetColumnName() = "department_id" then
	int val;
	val = Integer(this.GetText());
	if val != department then
	        department = val;
	end if
</code>end if

The problem so far is that if the teams drop down gets filtered and the user has previously selected a value which will be out of filter range, the drop down will still display the old id value. Will avoid this issue extending the pbm_dwndropdown and pbm_ncpaint events.

event ue_dropdown;
if GetColumnName() = "department_id" then
end if
event ue_ncpaint;
dwc.Retrieve(this.object.data[1, nDepartmentsColIndex]);

Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.