Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
I have a stored procedure that retrieves the "firstname" and " lastname" of all the employees.
Here My requirement is,
If I click on letter "A" , In the grid the "firstname" starts with "A" should be filtered out and displayed in the grid.
Similarly for the all 26 characters. How to bind "n" number of services to a single grid?
Is there any easiest ways to achieve this?
Solved! Go to Solution.
Steps:
1. Create a State Definition with 26 Characters as option. Keep Style same so that they look same.
2. In the Mashup; Add a Radio Button list and select ButtonStates as State Definition created in Step 1.
3. Create a Service which takes a character as Input and filter the Data. You can use Query to filter the data
example:
var params = {
maxItems: undefined /* NUMBER */
};
// result: INFOTABLE
var result1 = Things["TestDataTable1"].GetDataTableEntries(params);
var params = {
inclusive: true /* BOOLEAN */,
fieldName: "source" /* STRING */,
t: result1 /* INFOTABLE */,
pattern: "A*" /* STRING */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].LikeFilter(params);
4. Bind the SelectedText of the Radio Button to the service input parameter.
5. Bind the SelectionChanged to the service to call the service when the selection changes.
I hope it helps.
Hi Bavithraa Marimuthu,
I dont think you need create 26 services for the 26 characters seperately. Why not pass the character you clicked on as an input parameter for a service, and in the service you could make some filter to return back the wanted result to the Grid.
Please let me know if I understand your senario wrongly.
Thanks,
Br,
Anna
See in my scenario, I have 26 buttons for each alphabet and based upon the clicking of each button, it has to do filteration in the stored procedure.
As you suggested, I can pass the character clicked on as an input parameter for a service.
If that would be the case, how to make filter in the service?
Please help me out of this!!
Hi Bavithraa Marimuthu,
Instead of 26 Buttons use Radio Button with 26 characters as different options.
Now pass the selected Button output to the Custom Service which filters data based on the selected input.
I hope it helps.
Steps:
1. Create a State Definition with 26 Characters as option. Keep Style same so that they look same.
2. In the Mashup; Add a Radio Button list and select ButtonStates as State Definition created in Step 1.
3. Create a Service which takes a character as Input and filter the Data. You can use Query to filter the data
example:
var params = {
maxItems: undefined /* NUMBER */
};
// result: INFOTABLE
var result1 = Things["TestDataTable1"].GetDataTableEntries(params);
var params = {
inclusive: true /* BOOLEAN */,
fieldName: "source" /* STRING */,
t: result1 /* INFOTABLE */,
pattern: "A*" /* STRING */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].LikeFilter(params);
4. Bind the SelectedText of the Radio Button to the service input parameter.
5. Bind the SelectionChanged to the service to call the service when the selection changes.
I hope it helps.
What is the Snippet you have used above? From Where can I get that snippet?
Snippet name: LikeFilter
Thanks Ankit
But here, all 26 radio buttons diplay in single row.
I want to split the characters into 6 rows and a single grid to display the result.
Is there any other way to achieve this??
Hi Bavithraa Marimuthu,
You can try to use Event Router widget and add output of 6 Radio Buttons to different inputs of Event Router widget.
And bind output of Event Router widget to your custom service.
How to get Event Router Widget?
Could you share me the link to download it?
Which ThingWorx version you are on? It is part of core ThingWorx version 7.4
For previous versions; Tomas Coufal have shared the extension on following Thread: Events router
Note: As this extension is custom and has not been tested by PTC on previous versions (versions before 7.4); it will not be supported by PTC.
I am using TWX 7.3
Hello, just another idea of building mashup, if it's possible to use the List widget to show and to select the 26 letters, it's a lot easier to bind the letter selected to the service "LikeFilter" and to display data on the Grid.
Yes, we can use list widget. But that changes the UI of my existing application.