Search metadata for empty values

Post Reply
KingSwitcher
Newbie
Posts: 13
Joined: Fri May 03, 2024 8:30 pm

Search metadata for empty values

Post 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!
jan_suhr
Advanced member
Posts: 620
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Search metadata for empty values

Post by jan_suhr »

You can setup the submit point fields to require a value so that they can't be empty.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
User avatar
Soul Forge
Member
Posts: 29
Joined: Wed Jul 12, 2023 5:25 pm

Re: Search metadata for empty values

Post 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.
KingSwitcher
Newbie
Posts: 13
Joined: Fri May 03, 2024 8:30 pm

Re: Search metadata for empty values

Post 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.
KingSwitcher
Newbie
Posts: 13
Joined: Fri May 03, 2024 8:30 pm

Re: Search metadata for empty values

Post 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])
User avatar
Soul Forge
Member
Posts: 29
Joined: Wed Jul 12, 2023 5:25 pm

Re: Search metadata for empty values

Post 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.
KingSwitcher
Newbie
Posts: 13
Joined: Fri May 03, 2024 8:30 pm

Re: Search metadata for empty values

Post 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!
Post Reply