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!
Search metadata for empty values
Re: Search metadata for empty values
You can setup the submit point fields to require a value so that they can't be empty.
- Soul Forge
- Member
- Posts: 29
- Joined: Wed Jul 12, 2023 5:25 pm
Re: Search metadata for empty values
Well, you mentioned you're learning xpath. Wouldn't something like this work?
But like jan_suhr said, your problem can be solved marking the field as required.
Code: Select all
count(.//field/value[string-length(text())=0])
-
- Newbie
- Posts: 13
- Joined: Fri May 03, 2024 8:30 pm
-
- Newbie
- Posts: 13
- Joined: Fri May 03, 2024 8:30 pm
Re: Search metadata for empty values
Thanks. I modified it a bit, but it worked!Soul Forge wrote: ↑Sat May 18, 2024 4:43 am Well, you mentioned you're learning xpath. Wouldn't something like this work?But like jan_suhr said, your problem can be solved marking the field as required.Code: Select all
count(.//field/value[string-length(text())=0])
Code: Select all
count(//value[string-length(text())=0])
- Soul Forge
- Member
- Posts: 29
- Joined: Wed Jul 12, 2023 5:25 pm
Re: Search metadata for empty values
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.
Just so you know, I used //field/value because only //value could count values that are not related to fields, if they exist.
-
- Newbie
- Posts: 13
- Joined: Fri May 03, 2024 8:30 pm
Re: Search metadata for empty values
Understood. Thanks!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.