update collection when pattern does not match - does not update collection but triggers "callbacksuccess" function instead of "callbackfailure!

345 views
Skip to first unread message

tom.t.r...@googlemail.com

unread,
Nov 25, 2013, 12:29:43 PM11/25/13
to suppor...@runmyprocess.com
Hi
I have implemented a simple collection to store names, departments etc and created a back office page to maintain the data. It all seems to work fine. In particular the amend record (which uses a payroll number field as the pattern match to select a record) works ok - amending an existing record OK. However if I try to amend a non existing record by giving it a payroll value that does not exist it does not trigger the callbackfail routine as I believe it should - it triggers the callbacksuccess. Can you help please

The scripts called are below

in the js widget.........................


function update_ok(result) {
id_status_message.setHtml("<font color = 'green'><i>Colleague updated OK</font><i>");
}

function update_ko(result) {
id_status_message.setHtml("<font color = 'red'><i>Colleague failed to update</font><i>");
}
function updateperson(){
var my_pattern = {}
my_pattern.Cpayroll = RMPApplication.get("payroll");
var my_object = {};
my_object.Cname = RMPApplication.get("name");
my_object.Cpayroll = RMPApplication.get("payroll");
my_object.Cdept = RMPApplication.get("dept");
my_object.Cemail = RMPApplication.get("email");
my_object.Cnumber = RMPApplication.get("number");
col_Colleagues.updateCallback(my_pattern ,my_object ,update_ok,update_ko);
};

In the button script................

id_starting_message.setHtml("<font color = 'blue'><i>starting update action</font><i>");
updateperson();
id_report.refresh();

Thanks

Gareth Thiveux

unread,
Nov 25, 2013, 12:56:51 PM11/25/13
to suppor...@runmyprocess.com
Hi Tom,

If nothing matches your pattern, it's just that nothing will be updated, but it's not an error, therefore it's normal that the CallbackSucess function is called.
You can check the number of entries that have been updated with result.P_count.

You could then replace your CallbackSucess function by the following :

function update_ok(result) {
if(result.P_count > 0) {
id_status_message.setHtml("<font color = 'green'><i>Colleague updated OK</font><i>");
} else {
id_status_message.setHtml("<font color = 'red'><i>No colleague updated</font><i>");
}
}


Regards,

Pre-Sales Consultant / Consultant Avant-Vente
 Fujitsu RunMyProcess
3 rue de Gramont, 75002 Paris - France

     


Fujitsu RunMyProcess user? Please add a review on GoogleApps Marketplace

Afin de contribuer au respect de l'environnement, merci de n'imprimer ce message qu'en cas de nécessité.
Be environmentally friendly: do not print this email unless it is entirely necessary.



--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/bac1d00a-242f-412b-97cf-45dabf7b6596%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/groups/opt_out.

Tom Rothwell

unread,
Nov 25, 2013, 12:59:03 PM11/25/13
to suppor...@runmyprocess.com

Gareth

Many thanks for the prompt and clear response.

Regards

tom

You received this message because you are subscribed to a topic in the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/a/runmyprocess.com/d/topic/supportforum/Fl3T2LfkJOg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to supportforum...@runmyprocess.com.

Reply all
Reply to author
Forward
0 new messages