using loop to write multiple rows to a spreadsheet - getting a different row from an array each iteration

228 views
Skip to first unread message

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

unread,
Nov 11, 2013, 9:32:14 AM11/11/13
to suppor...@runmyprocess.com
Hi. I am trying to write a (synchronous) loop that takes each row from an input array and writes it to a spreadsheet.
I can get it to write the first row multiple times e.g. when I use for example
"<gsx:project>${my_array.project[0]}</gsx:project>"
(project is the first column name in the spreadsheet, my_array.project is the first column in the input array).

I tried using "<gsx:project>${my_array.project[${P-index}]}</gsx:project>" or indeed "<gsx:project>${my_array.project[${any variable}]}</gsx:project>" but this does not work. I guess my limited knowledge of Freemarker is to blame and that I have a syntax error or am doing it the wrong way. Could you please advise me to how to achieve this. Could you also point me to the place in the user guide where thsi is explained so that I can learn it for later.
Thanks
Tom

Dimitri MELCHIOR Pro

unread,
Nov 11, 2013, 1:19:27 PM11/11/13
to RunMyProcess Support Forum
Hi Tom,

Le tme give you some of the parameters you must configure,

1 - You connector box must be a "loop", "Based on an Array" which is ${my_array.project} (Actually, my_array is not an array structure but a JSON composed of multiple arrays that are the columns. That's why you must loop on one of these columns).

2 - Your XML input must look like this :

<gsx:project>${my_array.project[P_index]}</gsx:project>
<gsx:column2>${my_array.column2[P_index]}</gsx:column2>
<gsx:column3>${my_array.column3[P_index]}</gsx:column3>

(P_index must be written with an underscore)

Make sure that any cell of my_array widget is set up. If not, write this :

<gsx:project>${my_array.project[P_index]?default("")}</gsx:project>
<gsx:column2>${my_array.column2[P_index]?default("")}</gsx:column2>
<gsx:column3>${my_array.column3[P_index]?default("")}</gsx:column3>

Let me know if it works for you.

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/c6e41ee0-db2b-4b44-9b7f-9947bc22ea55%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/groups/opt_out.

Tom Rothwell

unread,
Nov 11, 2013, 4:12:38 PM11/11/13
to suppor...@runmyprocess.com

Dimitri

Many thanks. It works now. I was using P_index (type in my post, sorry). One question. I am using the expression “${P_index} = ${my_array.project?size}” as the loop control. i.e. using “?size” to get the number of rows in the array.  It does work, but is this the right expression, or is there a better way?

Many thanks

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/6U5XxO7iboM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to supportforum...@runmyprocess.com.

Dimitri MELCHIOR Pro

unread,
Nov 11, 2013, 4:19:17 PM11/11/13
to RunMyProcess Support Forum
Good to know that it works but there is a better way indeed. Just select Multi instance rather than While. "While" loops are used when you do not know the number of iterations at the begining. (refer my configuration below) :

Inline image 1

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.


image.png

ad...@wakefieldfamily.org

unread,
Nov 13, 2013, 7:52:10 PM11/13/13
to suppor...@runmyprocess.com
On Monday, November 11, 2013 4:19:17 PM UTC-5, Dimitri Melchior wrote:
> Good to know that it works but there is a better way indeed. Just select Multi instance rather than While. "While" loops are used when you do not know the number of iterations at the begining. (refer my configuration below) :
>
>
>
>
>
>
>
> Best regards.
>
>
>
>
>
> --
> Dimitri MELCHIOR
>
>
>
>
> PreSales Consultant
> Contact: dmel...@runmyprocess.com
>
> Tel: +33(0)1 75 77 51 78
> Mobile : +33(0)6 52 70 89 82
>
> Website: Fujitsu RunMyProcess
>
>
>      
>
>
>
>
>
>
>
Hi,

I followed this thread to and I am successfully getting the data in the spreadsheet. My issue is that I have two date input fields in my form, and it's not coming into the google spreadsheet in a formatted way. Can you tell me what I need to specify to properly capture the date in MM/dd/yyyy format in the spreadsheet, it's showing up on my web interface in this format as I have defined it in the Pattern field of the widget.

Thanks
Corey

Dimitri MELCHIOR Pro

unread,
Nov 14, 2013, 5:50:02 AM11/14/13
to RunMyProcess Support Forum
Hi,

I suppose you got a number of seconds (or milliseconds) since 1970, JAN 1st, didn't you? Could you execute that code when getting dates : get_date(my_date,"MM/dd/yyyy")? For your information :

get_date(second,format): returns a UTC date where second is the number of seconds elapsed since January 1st, 1970 and format is date format to be returned (cf. Java norm): get_date(31539600,"yyyy-MM-dd HH:mm:ss"). Inverse function is get_time().

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.

ad...@wakefieldfamily.org

unread,
Nov 16, 2013, 3:13:47 PM11/16/13
to suppor...@runmyprocess.com
On Thursday, November 14, 2013 5:50:02 AM UTC-5, Dimitri Melchior wrote:
> Hi,
>
>
> I suppose you got a number of seconds (or milliseconds) since 1970, JAN 1st, didn't you? Could you execute that code when getting dates : get_date(my_date,"MM/dd/yyyy")? For your information :
>
>
>
> get_date(second,format): returns a UTC date where second is the number of seconds elapsed since January 1st, 1970 and format is date format to be returned (cf. Java norm): get_date(31539600,"yyyy-MM-dd HH:mm:ss"). Inverse function is get_time().
>
>
>
>
> Best regards.
>
>
>
>
>
> --
> Dimitri MELCHIOR
>
>
>
>
> PreSales Consultant
> Contact: dmel...@runmyprocess.com
>
>
> Tel: +33(0)1 75 77 51 78
> Mobile : +33(0)6 52 70 89 82
> Website: Fujitsu RunMyProcess
>
>
>
>      
>
>
>
>
>
>
>
Hi Thanks for the response, but I am not sure where this function should be placed. I am assuming in the web interface, but not sure where in the date widget configuration it should go.

I need guidance on exactly where I should put this code snippet in my web interface.
Reply all
Reply to author
Forward
0 new messages