Data Input with Filter

Hi,

I am trying to create a data input form with 2 datacubes- DAPFamily, DAPChild.

The first set of fields and table 1 are for DAPFamily, the second set is for DAPChlid and table 2. Everything works fine as set up here.


What I want to do is to filter table 1 (Family) for the correct DAP Number and populate it into the (Child) DAP Number input field. I have gone back and forth with Dundas Support but still have not found a way to accomplish this.


If anyone knows how to make this work, please post details. I have tried using a member filter but that does not work no matter how I configure it.


Thanks in advance for any help!







1 Like

I had to check with the Support team to figure out what the issue here was. It seems that you are trying to use the same control as both a filter and an input field. The built-in functionality of the Data Input Interaction cannot handle this and gives an error.


I think the solution you are looking for is to separate the two controls. I can imagine two simple ways you can do this and maintain the look that you want:

  1. Add another text field. You can write a small script to populate the text with the string of the selected DAP Number, and then use this text field for your data input interaction. You can hide the secondary text field, so nothing will change visually.
  2. Remove the DAP Number filter and just have a text field there. Use a different form of interaction for the filtering. For example, clicking the DAP Number in the family table. You will again need a simple script to use that string to populate the text field though.


Hope this helps!

Thanks, this explanation is much clearer. I like option 2 but have no idea how to write the script.


I believe Azar from our Support team was going to follow up with you to help with that. Could you share your solution when it's ready?

Azar worked with me and it took some back and forth but she did hlep me get a working model for Elia's proposed solution(s):

For the first solution:

1. Hide checkboxes of the “DAP Number” member filter, so the user can only choose one member at a time. You can do this by unchecking the “Show Checkboxes” in Look tab of the Member Filter control.

2. Create a Textbox Filter for DAP Number and copy its script name somewhere to use it later in the scripts,

3. Hide the textbox from Layout tab by unchecking “Hidden”.

4. Add below script to the “Parameter Value Changed” of the DAP Number” Member Filter.

You may need to change the highlighted part to match your viewparameter and textbox filter names


----------------------********************--------------------------

debugger;

// Get the viewParameter name of the DAP Number member filter

var baseViewService = this.getService("BaseViewService");

var myParameter = baseViewService.currentView.control.viewParameters.filter(function(item) {

return item.name === "viewParameter1";

})[0];

// Get parameter value

var filteredValue = myParameter.parameterValue.values[0].uniqueName;

// Return the first part of the UniqueName before ".", since it is like "700.ProductID" and we need only the number

var textValue = filteredValue.slice(0, filteredValue.lastIndexOf("."));

// Set the parameterTextBox value with the selected value

parameterTextBox1.control.value = textValue;

----------------------********************--------------------------

5. Add this Textbox filter setting to the “Data Input Interaction”


This should populate the Textbox filter with the selected value and then pass it to the Data Input table.


I had trouble making this work until Azar told me:


The issue is that you’ve used the Member Filter control Script name instead of its viewParameter script name in the scripts. By default, the name is something like viewParameter1. You can check this, by selecting your Member Filter control DAP Number, right click on that , select “Connect Filters” and see the viewParameters name.


So far so good... but when I added new data to the Family data input the Member filter did not add the data... back to Azar.


You can resolve this by following these steps:

1. Enable Bypass Data Cache for the metric set that the Member filter is bound to, (here, it would be your parent table and the”DAP Number Member filter” should be bound to the above table which has all the DAP Numbers)

2. Add below script to the “Data Changed” event of your parent table, so it refreshes the Member Filter items after updating the table:


parameterHierarchy1.control.setInheritedFilterValues(null);

parameterHierarchy1.loadData();

Please note that you’d need to replace your Member Filter control script name instead of the highlighted part.


Now everything works exactly as needed. Thanks, Azar!


This was just a proof-of-concept project. Now that support has worked this out for us, the final project will be much more invloved.


We see this as a more agile solution to capture data from short-term or new (volatile) initiatives, than programming applications. Plus, we can easily combine it with our other data.


Sandi