Sharpharp1
Apprentice

Save all list items in one record?

Hi all,

 

I currently have an Editable List View which allows users to have several rows into a list. When the rules save the results, it saves each ROW as a NEW record in the smartobject.

 

How can I make all the list items save under just ONE record, rather than save each row as a new entry?

 

Reason i ask is i want to then in my workflow pull all the records into one big MEMO field

 

Possible?

0 Kudos
Reply
4 Replies
Albarghouthy
Apprentice

Re: Save all list items in one record?

Hi Sharpharp1,


 


List views were not designed for this purpose, I can only think of one inefficient workaround which is to add  a data label fpr each column.


 


For example if you have 5 columns, you will need 5 data labels and then create 'For Each' rule to loop through the list items 


 


For all rows


Transfer data


 


in the transfer data action you will need to transfer the smartobject property for each column to the related data label and also pass the data label itself:


 


5213i29C64195A3D55248.png


 


If you have a lot of rows, you will encounter performance issues.


 


Is the data source SQL? can you not use stored procedure to concatenate the required rows?


 


 

Reply
Sharpharp1
Apprentice

Re: Save all list items in one record?

Hi Mustafa,

 

Thanks for the swift reply...

 

Just to add, there is only 5 columns - name, id, dept, email, role

 

In my estimation, there is not likely to be any more than 20 users added to the list at any one submission.

 

So basically, instead of saving each row as a seperate record in the Smartobject, I want it display the list in the form, but when doing a SAVE, I want it to concat all the rows into one field and SAVE in one entry in the Smartobject...

 

The main reason for having all the rows concatenated into one field is because the record in the smartobject is passed onto another system. Having multiple rows isn't going to work, but having one row of data will, as i can pass each field across, rather than multiple rows.....

 

Hope that makes sense

 

i.e. Rows on List

 

joe, id001, finance, manager

pete, id004, finance, supervisor

 

on save, copy all the above into one field

 

Is there any other way of achieving this outside of list views? Is it possible to lookup Users and details and add them to a text box and keep adding other users to it?

0 Kudos
Reply
Albarghouthy
Apprentice

Re: Save all list items in one record?

Hi Sharepharp1,


 


How do you expect the output of the two rows in one field only?


 


joe, id001, finance, manager

pete, id004, finance, supervisor

 

you can set them in one field using the workaround provide it in my first response but you will need one data label and loop through the list items to concatenate all the value in one data label 

 

the output will look 
joe, id001, finance, manager, pete, id004, finance, supervisor

 

you can pass static values to make look better:

 

Name:joe, ID:id001, Dep:finance, Role:manager, Name:pete, ID:id004, Dep:finance, Role:supervisor,....

 

example of the transfer data action in my for each:

 

5215i967ED11A02C720DA.png

 

Every iteration it will add the row to the data label and preserve the previous value of the data label.

 

You will need to consider that this will not be displayed in a list view once saved so you can save the string in a seperate table if you would like to display the rows later.

 

If your data source is SQL I would recommend to write stored procedure to concatenate these rows, otherwise you will need to implement the first suggestion.

 

Have a look at the following if you need help with the stored procedure.


 

you can use picker control (multi select enabled) for this and configure the display value to show the required fields then save the display field (not tested)

 

5216i828A0AB04B8E909F.png

 

Hope that helps

0 Kudos
Reply
Sharpharp1
Apprentice

Re: Save all list items in one record?

Thanks Mustafa,

 

Spent quite a bit of time on this and got it working (still not sure how)...

 

Basically, I removed the rules which save/create the records in the Smartobject.

I then do an Apply to Row - when Subview is closed, this then goes back to the main form and displays the entry (but doesn't write it to the Smartobject)

 

I added a cheaky Data lable in the footer of the list view.

 

Thanks to your idea of the For all Loop, i used that on Submit button to loop through all the displayed rows and do a transfer and all all 5 fields into one Field with a sneeky <BR> tag to display each record on a new line.

 

I then save everything and bingo, one record saved with all my entries in a single "Super-field" -just my name for it

 

My next test is to see how this passes that Super-field into a web-service to see how it comes out in an email to the user.... fingers crossed this works

 

Thanks again Mustafa for the pointers bro

0 Kudos
Reply