Collection querying another collection

298 views
Skip to first unread message

bestfri...@gmail.com

unread,
Sep 5, 2013, 3:10:40 PM9/5/13
to suppor...@runmyprocess.com
Hi,

I am trying below functionality in RMP

1.Uploading csv file through file upload widget


2.Moving the csv data to collection


3. And i have master collection which is having complete data.


4.When i upload the csv, the elements in csv collection must have a look up in master collection and return matching elements to a have collection or html table or any other means.

Please find the detailed flow in the attachment

testcsv.xlsx

bestfri...@gmail.com

unread,
Sep 5, 2013, 3:23:34 PM9/5/13
to suppor...@runmyprocess.com, bestfri...@gmail.com

Please ignore previous attachment...Consider this attachment

testcsv.xlsx

Sabine El Rassy

unread,
Sep 6, 2013, 6:20:01 AM9/6/13
to RunMyProcess Support Forum, Nagasai aytha
Hello Nagasai,

In order to achieve what you're trying to do, you need to create a composite API and link it to your web interface. So you'll have to add a JS widget that listens to 'id' variable. The content of your js will look like follow: RMPApplication.set("trigger_api",Math.random());
Then you link your Composite API to your interface and you configure it as follow:

Inline image 2

That means that the composite API will be triggered when the trigger_api variable changes.

Now in your API you have to do the following steps:
1. import your excel file into testcsv collection. Make sure the header of the column in the .csv file does NOT contain any spaces!

variable : foo
value     : ${import_objects("id","testcsv", ",","true")}

2. You get the list of items in your testcsv collection grouped by item_number as follow

variable : res_test
value: 

<#assign my_pipeline1>
 {"$group":{"_id":{"item_number":"$item_number"}}}
</#assign>
<#assign my_pipeline2>
 {"$project":{"item_number":"$_id.item_number"}}
</#assign>
<#assign my_pipeline3>
 {"$sort":{"item_number":1}}
</#assign>
<#assign my_pipeline1 = my_pipeline1?eval>
<#assign my_pipeline2 = my_pipeline2?eval>
<#assign my_pipeline3 = my_pipeline3?eval>
<#assign res_test=aggregate_collection("testcsv",my_pipeline1,my_pipeline2,my_pipeline3)>
${res_test}

3. You get the list of items in your master collection grouped by item_number as follow:
variable : res_master
value: 
<#assign my_pipeline1>
 {"$group":{"_id":{"item_number":"$item_number"}}}
</#assign>
<#assign my_pipeline2>
 {"$project":{"item_number":"$_id.item_number"}}
</#assign>
<#assign my_pipeline3>
 {"$sort":{"item_number":1}}
</#assign>
<#assign my_pipeline1 = my_pipeline1?eval>
<#assign my_pipeline2 = my_pipeline2?eval>
<#assign my_pipeline3 = my_pipeline3?eval>
<#assign res_master=aggregate_collection("master",my_pipeline1,my_pipeline2,my_pipeline3)>
${res_master}

4. You get the intersection between the data in res_test and res_master as follow:

variable : res
value:

<#assign res = []>
<#list res_test as x>
<#list res_master as y>
<#if (x.item_nb= y.item_nb)>
<#assign res = res+ [y]>
</#if>
</#list>
</#list>
${res}

5. You go back to the interface, and you configure the completed script as shown in the screenshot. That code allows you to have the result of your composite API available in your web interface within the varaible res_array. So now you have your data as an array, you can display it as you wish using javascript.

Inline image 1


Hope that was clear enough to help you proceed what you're trying to do.

Regards,

Sabine

image.png
image.png

bestfri...@gmail.com

unread,
Sep 6, 2013, 2:55:11 PM9/6/13
to suppor...@runmyprocess.com, Nagasai aytha
On Friday, September 6, 2013 6:20:01 AM UTC-4, Sabine El Rassy wrote:
> Hello Nagasai,
>
>
> In order to achieve what you're trying to do, you need to create a composite API and link it to your web interface. So you'll have to add a JS widget that listens to 'id' variable. The content of your js will look like follow: RMPApplication.set("trigger_api",Math.random());
>
> Then you link your Composite API to your interface and you configure it as follow:
>
>
>
>
>
>
> Hope that was clear enough to help you proceed what you're trying to do.
>
>
>
> Regards,
>
>
> Sabine

Hi Sabine,

Could you please tell me how to create Composite for this scenario ?


Using collection and creating composite for the above example?


And also i didnt get point about the variables - foo and getting the itemnumbers by group by?



rmp.PNG

Dimitri MELCHIOR Pro

unread,
Sep 9, 2013, 4:29:50 AM9/9/13
to RunMyProcess Support Forum, Nagasai aytha
Hi Nagasi,

Sabine were exhaustive enough when replying your questions.

We need you to be exhaustive as well when asking. We do not have information enough. (i.e. Could you please tell me how to create Composite for this scenario ? >> Go to your project, click on create and Composite API then).

Waiting to help you further.

Best regards

--

Dimitri MELCHIOR

PreSales Consultant

     

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/62e57bda-90ee-4a89-bae8-12fca214658c%40runmyprocess.com.

bestfri...@gmail.com

unread,
Sep 9, 2013, 10:30:44 AM9/9/13
to suppor...@runmyprocess.com, Nagasai aytha
On Monday, September 9, 2013 4:29:50 AM UTC-4, Dimitri Melchior wrote:
> Hi Nagasi,
>
>
> Sabine were exhaustive enough when replying your questions.
>
>
> We need you to be exhaustive as well when asking. We do not have information enough. (i.e. Could you please tell me how to create Composite for this scenario ? >> Go to your project, click on create and Composite API then).
>
>
>
> Waiting to help you further.
>
>
> Best regards
>
>
>
>
>
> --
> Dimitri MELCHIOR
>
>
>
>
> PreSales Consultant
> Contact: dmel...@runmyprocess.com
>
>
> Tel: +331 75 77 51 78
> Mobile : +336 52 70 89 82
> Website: Fujitsu RunMyProcess
>
>
>
>      
>
>
>
>
>
>
>
Hi Dimitri,

Sorry for the confusion, I followed the same steps which Sabine has replied but i stuck up at initial step of creating composite API and the tuitorial which is already available in user guide is having example which is completely different and is based some previously built project.

So i was trying to replicate same project from my side to know about Composite API.

Could you please share any tuitorials/any more examples using Composite for exploring from my side?

Sorry for the inconvenience

Thanks

Dimitri MELCHIOR Pro

unread,
Sep 10, 2013, 5:33:36 AM9/10/13
to RunMyProcess Support Forum, Nagasai aytha
Here is a tutorial on how to create a composite API :


If you are blocked, tell me where exactly in the tutorial.

Best regards.

--

Dimitri MELCHIOR

PreSales Consultant

     
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.
Reply all
Reply to author
Forward
0 new messages