Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

2 Drop downs to Filter Data

Avatar

Level 2

Hi

Working on a project that requires 2 drop downs to filter the next third drop down.

Need user to select ClientID and YearID

I have the code working for the first dropdown (ClientID), but unable to get the second drop down to show JUST the data related to the selected clientID.

I am using these Data connections:

Clients -  providing the ClientID's

ClientsDetail -  Same as above but is the selected record from the first Drop down (ClientID)

Years -  providing the ClientID's and YearID

The first drop down has the following JavaScript (selecting the Client ID and displaying the selected data from ClientsDetail

form1.#subform[0].SelectedClientID::change - (JavaScript, client)

var inName = xfa.event.newText;
if (inName == ""){
app.alert("You must enter a valid name - try again!")
}
var nIndex = 0;
while(xfa.sourceSet.nodes.item(nIndex).name != "ClientsDetail")
{
nIndex++;
}

var oDB = xfa.sourceSet.nodes.item(nIndex).clone(1); // the node pertaining to the data connection specified
oDB.nodes.item(1).query.setAttribute("text", "commandType");
oDB.nodes.item(1).query.select.nodes.item(0).value = "Select * from Clients where ClientID = '" + inName + "'";
//now connect to DB and get a record
oDB.open();
oDB.close();

So now I have the selected ClientID in SelectedClientID.rawValue

How do I code a second Drop down to pull data from Years with the filter that uses this SelectedClientID.rawValue?

What I am looking for is the setup code that will allow the following SQL select to work

var myClientID = SelectedClientID.rawValue;

"Select * from Years where ClientID = '" + myClientID + "'";

Any pointers would be greatly appreciated.  Thanks

1 Reply

Avatar

Level 2

Case closed - have it working.

Look at the custom drop down lists and pull down a Data drop-down, the code needs work, but it works!