Hello Ventuzians!
THE FORUMS ARE CLOSED!

Please join our discord server HERE!! << click me :D

We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server

Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!

Expression Help

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

Post Reply
ChrisFlye

Expression Help

Post by ChrisFlye » 22 Mar 2012, 16:35

Hi all,

I'm trying to get a boolean output from a string expression. Simply, if there is no text (null) give me 1, if there is some text give me 0. I'm using the following but to no avail.

A == "" ? 1 : 0

How do I express a null value in a String Expression?

I'm getting 'cannot convert int to string'.

Thanks,
Chris

User avatar
squiggle
Posts: 31
Joined: 18 Jan 2012, 17:54

Re: Expression Help

Post by squiggle » 23 Mar 2012, 10:33

Does it have to be an expression? I'd just use the "String Length" node, you feed the string into it and it gives you a number of informative outputs, among them a boolean as to whether the string is empty.

http://www.ventuz.com/support/help/late ... tions.html

User avatar
Daniel Willer
Posts: 309
Joined: 06 Jan 2012, 18:12

Re: Expression Help

Post by Daniel Willer » 23 Mar 2012, 10:41

You can use the IsNullOrEmpty() method.
Your Int expression should look like that: String.IsNullOrEmpty(A) ? 1:0
Check MSDN for further information.

By the way you cannot output a 0 or 1 in a string expression because the result has to be a string. But you can add a string arguement via the CustomModel to an Integer Expression.

Cheers!

ChrisFlye

Re: Expression Help

Post by ChrisFlye » 23 Mar 2012, 19:42

Both of those were useful. Sorted!

Thanks a lot!

dodgygizmos

Re: Expression Help

Post by dodgygizmos » 26 Mar 2012, 16:20

goats cheese :-)

Post Reply