Klint
Posts: 0
Joined: Mon Feb 03, 2014 5:08 am

Make null value as a failure when checking database

Hi,

I've been trying to figure this out for a couple of days now without any success. Please someone help me.

I have created a string check field where a user inputs a string and it checks the database with 'where' statement. when i do the testing on it with;

i put {"username":"onethatexists"} in the 'where' field, it returns 'success' with the user information and when

i put {"username":"onethatdoesnotexists"} in the 'where' field, it returns 'success' with [] (null)

so my question is.. how do i make it so that if the null value '[]' is returned, it's a failure?

Please help!!

thanks

Klint
Posts: 0
Joined: Mon Feb 03, 2014 5:08 am

Make null value as a failure when checking database

btw,

I have created an 'invoke' above service when a user clicks on a button with the following javascript -- return '{"username":"+value+"}';

Klint
Posts: 0
Joined: Mon Feb 03, 2014 5:08 am

Make null value as a failure when checking database

so i am thinking what i'm trying to do could be accomplished either when i create the service or put some extra steps in the custome javascript.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Make null value as a failure when checking database

Hello! [] is not null, it's empty array. Could you clarify why do you need error event? On service success event you can check data.length. If it's equal to 0, the result is empty and you can do actions you need.

Return to “Issues”