Search: java action or microflow activity

3
is it possible to mimic the search funcionality provided on datagrids with a microflow or java action? I need the search fields to be optional hence a retrieve is not going to work - and I cannot use the grid's search form as I need to provide an option based on the result (found/did not find records) I do not want to manipulate the search functionality, I wish to do the same within a java-action or a microflow, because if the search form does not find a record it simply shows an empty grid. I would like to display a form in that case. The form should give the user the option to create a new record if none has been found. I tried using a microflow checking if self-created searchfields are empty or "", however this has proven to be very tricky as the xpath constraint of a retrieve action is not very dynamic. Besides the Truth table gets very big and makes the microflow very complex. Example: 4 searchfields (not from the inbuilt search form, but from a normal form) - with 4 search fields I get a truthtable (matrix) of 4x4 = 16 false being empty and true not empty based on this I have to create a retrieve ... there must be a better solution - the inbuilt search functionality must be working on the same concept as fields are optional hence empty fields somehow get ignored
asked
4 answers
6

If you want to do the search with a microflow, you can use just a single retrieve instead of 4 x 4 = 16 separate retrieves, but the XPath gets a bit complicated. Such an XPath query for 4 search fields would look like this:

[
   ($searchField1 = empty or Attribute1 = $searchField1) and
   ($searchField2 = empty or Attribute2 = $searchField2) and
   ($searchField3 = empty or Attribute3 = $searchField3) and
   ($searchField4 = empty or Attribute4 = $searchField4)
]
answered
3

With Core.retrieveXPathQuery(..) in a Java action you can search whatever you want to. Just browsing around on this forum or searching the documentation should result in quite a few examples.

answered
0

That's not possible. You can only use XPATH on a search filter.

answered
0

I do not want to manipulate the search functionality, I wish to do the same within a java-action or a microflow, because if the search form does not find a record it simply shows an empty grid. I would like to display a form in that case. The form should give the user the option to create a new record if none has been found.

I tried using a microflow checking if self-created searchfields are empty or "", however this has proven to be very tricky as the xpath constraint of a retrieve action is not very dynamic. Besides the Truth table gets very big and makes the microflow very complex.

Example:

4 searchfields (not from the inbuilt search form, but from a normal form) - with 4 search fields I get a truthtable (matrix) of 4x4 = 16 false being empty and true not empty

based on this I have to create a retrieve ...

there must be a better solution - the inbuilt search functionality must be working on the same concept as fields are optional hence empty fields somehow get ignored

answered