Assign 0 to list when SQL return ed no rows
Application Type
Reactive

Hi all! Sorry for such a newbie question, but is it possible to assign a parameter with data type list to 0 when SQL return no rows? Thank you in advanced! ????

Solution

Hi Syakir..

I think you can put IF condition with this value:

Get_Valid_BNT.List.Empty

if it returns false, set Assign node to

VALID BNT=Get_Valid_BNT.List

if it returns true, just end the action flow, because by default VALID_BNT is an empty list

I hope this works for your case.

Thanks!

Solution

Thank you so much sir! It works perfectly fine! 

Solution

Thank you so much sir! It works perfectly fine! 

Hi Syakir,

Good evening!

What you can do is use a If condition instead:

VALID_BNT =

if(get_valid_bnt.list.empty = true,

     0,

     1

)

Or

VALID_BNT =

if(get_valid_bnt.list.empty,

     0,

     1

)

You can replace the 1 with your desired requirement/value 

Hope this helps.

Kind regards,

Chris



But for my situation, the parameter that needed to be assign is using data type list not integer, so is there anyways for me to set parameter with datatype list to 0? Because i can't change my parameter data type..

Hi Syakir,

Why do you need it to be Zero? What's your use case?

Kind regards,

Chris

Hi Syakir, 

may I ask what is the purpose of your requirement?
If the query returns empty, you will have that output result available for you, no need for extra output attributes.

maybe I'm not getting your point.

Best Regards, 

Paulo Z

Hi Mr @Paulo Zacarias , as right now after I create SQL statement, if it's return no row, I need to assign output parameter of VALID BNT to 0 (can refer to picture above), as the parameter will be use to other action..

hope my explanation helps..


Alright Syakir, 

but you can use the Empty property of the SQL list output instead of that additional parameter.

If you really need to store the value 0 whenever the list comes empty, just add a local variable to the screen and assign this value when the list is empty. Then you can use this variable with the 0 value on that screen's actions/flow.

Hope this helps.

Best Regards, 

Paulo Z

Solution

Hi Syakir..

I think you can put IF condition with this value:

Get_Valid_BNT.List.Empty

if it returns false, set Assign node to

VALID BNT=Get_Valid_BNT.List

if it returns true, just end the action flow, because by default VALID_BNT is an empty list

I hope this works for your case.

Thanks!

Solution

Thank you so much sir! It works perfectly fine! 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.