Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
5 replies
Subscribers
9 subscribers
Views
2030 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
What is the best way to achive: I have a form with around 10(country, ssn,
raghunandanj3904
Certified Senior Developer
over 12 years ago
What is the best way to achive:
I have a form with around 10(country, ssn, fname, lname, age, etc) search criteria fields. User is required to mandatorily enter only one field. Rest 9 are optional.
In this case, what would be the best implementation way?? I need to fetch the records from the DB(2 different tables) for the entered criteria. If I use Query Database, how my SQL looks like since the where clause is dependent on the user input.
Any guideline / document would be of great help.
TIA....
OriginalPostID-63845
OriginalPostID-63845
Discussion posts and replies are publicly visible
0
iainf
over 12 years ago
One option would be to have a "length(trim(filternulls({pv!one,..., pv!ten}))) = 1" decision straight after the form and direct back if false. Then you could display an error flag 'Please enter only one search criteria'. You can use the same node to direct the flow depending on the entered value.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
raghunandanj3904
Certified Senior Developer
over 12 years ago
I m sorry in my earlier post. I meant one input is anyway mandatory and 9 are optional, which said minimum one input and max 10 inputs.
And also, the result should be displayed in a paging grid and in the paging grid user can select multiple rows and the selected rows to be displayed in another grid.
The display part in grid and data handling can be managed but my concern is how to get the data onto the first grid. I suppose I can only use query rules to get the data onto the paging grid. but then how to have the dynamic where clauses in Query Rules??
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
iainf
over 12 years ago
Appologies, on your first point, a decision "length(trim(filternulls({pv!one,..., pv!ten}))) > 1" should do the trick- or and(isnull(pv!one), ... isnull(pv!ten)) or something.
On your second point, if you can't use query rules to do exactly what you need you could create a view in the DB (restrict your tables to the required columns) and use a query db node to do a direct SQL query. This would give you much more latitude.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Bishnu Panigrahi
Appian Employee
over 12 years ago
Regarding making a query rule:
As Iain suggests, making a view on those 10 fields can help with making the search query rule. Also, the "includes" operator can handle null rule inputs in query rules. So if each field's query condition uses the "includes" operator, you won't have to filter out your null values for the query rule to execute. For more info:
forum.appian.com/.../Rules
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
raghunandanj3904
Certified Senior Developer
over 12 years ago
Thanks Iain and Bishnu.. will check with "includes" operator.. Hope it helps...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel