Page 1 of 1
Search metadata for empty values
Posted: Fri May 17, 2024 9:27 pm
by KingSwitcher
I need to create a routing condition that requires all metadata fields to have a value (not empty).
The metadata list can vary depending on the submit point, so I need a solution that is able to search through all levels of <value></value> elements.
I'm learning Xpath expressions and it looks like that's where this solution is headed but any guidance would be much appreciated!
Re: Search metadata for empty values
Posted: Fri May 17, 2024 9:42 pm
by jan_suhr
You can setup the submit point fields to require a value so that they can't be empty.
Re: Search metadata for empty values
Posted: Sat May 18, 2024 4:43 am
by Soul Forge
Well, you mentioned you're learning xpath. Wouldn't something like this work?
Code: Select all
count(.//field/value[string-length(text())=0])
But like jan_suhr said, your problem can be solved marking the field as required.
Re: Search metadata for empty values
Posted: Sun May 19, 2024 4:56 am
by KingSwitcher
jan_suhr wrote: ↑Fri May 17, 2024 9:42 pm
You can setup the submit point fields to require a value so that they can't be empty.
I need the option to leave fields empty.
That's why I need a condition to route the job to a different checkpoint if any fields are left empty.
Re: Search metadata for empty values
Posted: Sun May 19, 2024 5:00 am
by KingSwitcher
Soul Forge wrote: ↑Sat May 18, 2024 4:43 am
Well, you mentioned you're learning xpath. Wouldn't something like this work?
Code: Select all
count(.//field/value[string-length(text())=0])
But like jan_suhr said, your problem can be solved marking the field as required.
Thanks. I modified it a bit, but it worked!
Code: Select all
count(//value[string-length(text())=0])
Re: Search metadata for empty values
Posted: Mon May 20, 2024 2:46 pm
by Soul Forge
Glad I could help.
Just so you know, I used //field/value because only //value could count values that are not related to fields, if they exist.
Re: Search metadata for empty values
Posted: Wed May 22, 2024 5:36 pm
by KingSwitcher
Soul Forge wrote: ↑Mon May 20, 2024 2:46 pm
Glad I could help.
Just so you know, I used //field/value because only //value could count values that are not related to fields, if they exist.
Understood. Thanks!