Delete objects from collection

414 views
Skip to first unread message

mosa.gh...@gmail.com

unread,
Jun 25, 2015, 7:39:37 AM6/25/15
to suppor...@runmyprocess.com
Hello Support,

How Do I delete a number of objects from a collection based on their creation date , especially that this collection has a column "creation date" but it defines as a string ??

So what I need is to remove a group of objects from my collection based on their creation date (i.e remove /delete objects that had created before 6 months)

Best Regards,

Mousa Gharaibeh
Analyst , Business Process Automation
Corporate & Technology Services
Office :  +962 6 5800936
Mobile: +962 796579097          
Email: mousa.g...@sita.aero

Murali

unread,
Jun 26, 2015, 7:43:25 AM6/26/15
to suppor...@runmyprocess.com, mosa.gh...@gmail.com, mosa.gh...@gmail.com
Hi Mousa,

Please find below sample code template to delete data for a specific date and update as per your requirement.

function delete_ok(result) {
    alert("ok " + JSON.stringify(result));
}
function delete_ko(result) {
   alert("ko " + JSON.stringify(result));
}
var my_pattern= {};
my_pattern.creation date = "Any Date";
Collection_name.removeCallback(my_pattern,delete_ok,delete_ko);

Regards,
Murali

mosa gharaibeh

unread,
Jun 30, 2015, 5:11:48 AM6/30/15
to Murali, RunMyProcess Support Forum
Hi Murali,

Thanks a lot for your support , but if I need to implement the less than or greater than not equal , is it applicable if yes how?

P.S creation date define as a text 

Please Help

Best Regards,

Mousa Gharaibeh
Analyst , Business Process Automation
Corporate & Technology Services
Office :  +962 6 5800936
Mobile: +962 796579097          
--
 
 
 
 
Regrads,
Mousa Gharaibeh

Pankaj Kumar

unread,
Jun 30, 2015, 8:02:03 AM6/30/15
to suppor...@runmyprocess.com, Murali
Hi Mosa,

Since the date is in string type in the collection, you can not use the comparative operator on it.

you can write the free-marker code to list all the objects from the collection, converting string to timestamp using the "get_time" method and save this value in  new column, say creation_date_num, and update it back in the collection using the loop. This way you have two column for the creation date, one is "string" type and other one have the "numeric" value.

After that, you can delete the objects from the collection based on the "creation_date_num".



Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" 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/CAL-%3Dn-xDWXNA_XU3us1wr0gD7WU07ZrrfKd6AV6QADHQChiLqQ%40mail.gmail.com.

mosa.gh...@gmail.com

unread,
Jul 1, 2015, 6:52:06 AM7/1/15
to suppor...@runmyprocess.com, mosa.gh...@gmail.com
Hello Kumar,


How can we loop on all collection objects?


Regards,
Mousa Gharaibeh

mosa.gh...@gmail.com

unread,
Jul 1, 2015, 7:36:06 AM7/1/15
to suppor...@runmyprocess.com, mosa.gh...@gmail.com
I have made a search and found how by count of objects before make a loop

${count_objects( query, collection_name)}

Regards,
Mousa Gharaibeh

Pankaj Kumar

unread,
Jul 1, 2015, 2:17:23 PM7/1/15
to suppor...@runmyprocess.com, mosa gharaibeh
Hi Mousa,

Please find the freemarker script to add a new column of creation-date_num from taking value of creation_date_str in all records of a collection.

<#assign data = list_objects({"$query":{}},"collecton_name")>
<#assign tempArray = []>
<#list data as i>
<#assign str_date_num = get_time(i.creation_date_str,"MM/dd/yyyy")>
<#assign tempObject = P_json_accumulate( i, "str_date_num", creation_date_num )>
<#assign tempArray = tempArray + [tempObject]>
</#list>
${save_object(tempArray,"collecton_name")}

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


Regards,
Mousa Gharaibeh

--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" 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/.
Reply all
Reply to author
Forward
0 new messages