One of the field is empty throw exception?

i am having 4 code num, each code extracting some fields.
one time we are getting one code only, base on that code we will extract the particular code felids.

for ex
code num1-- name
age
gender

code num2–name
sure name
class
age
code num3–name
age
college

In code num1 – if any one of the field(name or age …) is missing we should throw an exception. same for each and every code.

what will be the logic here can any one help me.
how build this sequence.

You can use an If statement on the output and use the condition:

String.IsNullOrWhiteSpace(YourString)

In the Then path you can have a throw and in the Else it can just be left empty or a log message

1 Like

hi @moulton, i am having not a single field, like 5 to 6 fields in each code in that case should i apply each and every field in if condition.

Hi @meeraa , I’m sure you could find a way to fit it into one line of code, but having 5 to 6 If statements with clear exception messages will be the quickest to develop and the most straightforward for other developers to understand

1 Like

hi @moulton , how to add not for String.IsNullOrWhiteSpace(YourString)

1 Like

Hi @meeraa ,
Try this:

String.IsNullOrWhiteSpace(YourString) = False

This should put the happy path into the ‘then’ path

1 Like

@meeraa Trt the below workflow

Example.zip (11.2 KB)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.