Page 1 of 1

Make null value as a failure when checking database

Posted: Fri Feb 07, 2014 3:13 pm
by Klint

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


Make null value as a failure when checking database

Posted: Fri Feb 07, 2014 3:24 pm
by Klint

btw,

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


Make null value as a failure when checking database

Posted: Fri Feb 07, 2014 3:25 pm
by Klint

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.


Make null value as a failure when checking database

Posted: Fri Feb 07, 2014 4:42 pm
by Maryna Brodina

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.