Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Is it possible to have the same button run both a create service and an update service?

Hi Ellen,

Could not reproduce this problem in your app cause of another problem.

Take a look here: http://prntscr.com/5i0wpk/direct

Please fix this problem first.

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

There is something wrong with this line of code.

var isCreated = data.length 0; // this expression will return true or false

I do not know what exactly is wrong.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

Could it be possible that this code messes with the read service and query part of the mapping? Also, how would it know where exactly data.length is supposed to find the length?

var isCreated = data.length 0; // this expression will return true or false
if (isCreated) {
check_update.execute();
} else {
checkbox_create.execute();
};

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Is it possible to have the same button run both a create service and an update service?

Hi Ellen,

This code has one predefined variable "data" and is should an array.

May be you have not this variable?

Use console.log to see what is there..

pre

console.log("data = ");
console.log(data);

if(!data)
data = [];

var isCreated = data.length 0; // this expression will return true or false
if (isCreated) {
check_update.execute();
} else {
checkbox_create.execute();
};

/pre

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

It just simply returns data = with nothing behind it.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Is it possible to have the same button run both a create service and an update service?

Hi Ellen,

This code does not returns anything.. This code invoke different services depends on some condition.

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

Sorry I meant in the console, all it says is data =

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

If there is nothing behind the = sign, where do I go from there?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Is it possible to have the same button run both a create service and an update service?

Hi Ellen,

If this code type empty message that means you have empty data.

So debug it to have correct value.

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

I think I need some sort of variable to say what isCreated actually is. How does it know where to search?

Return to “Issues”