K2 SmartForm Rules - For Each Loop Possible?

  • 16 April 2015
  • 3 replies
  • 31 views

Badge +5

Hi,

 

Does anyone know of a way to use a for each loop in K2 Smartform rules?? 

 

I have a form with a list view which by default has 1 row. If the user selects an option then a certain number of rows are automatically created in the list view. For example, qty = 10 so 10 rows should be created with the same data from the form but with different id's. I essentially want to call the SMO Create method 'qty' number of times. 

 

I know how to do it on the workflow side but this really needs to be done on the form as the user needs to determine how many rows  should be in the table (in some cases the default 1 row is sufficent) and then enter data against each row.

 

I suppose I could create a stored proc but was hoping I could do it on the form 

 

Regards,

Ciara


3 replies

Userlevel 1
Badge +8

Hi ciaramc

 

SmartForms 4.6.9 has a "for each" rule. I haven't seen so I'm not sure it could do what you want. Have a look at the new features list (http://help.k2.com/KB001650#)

 

Otherwise I think a stored procedure is your best bet - call a smartobject method to create the number of rows required and then refresh the list to display them.

Badge +5

Hi Andrew,

 

Thanks for the information. We are still on 4.6.8. so the stored proc option is what I've had to go for.

 

Very handy to know its available in the latest release though

 

Regards,

Ciara

Badge +10

Smartforms 4.6.9 does have and equivalent of the for loop but this is only works for the data that is already in the list view. 

I dont think what ou are trying to achieve will be possible even with the use of this loop.

 

Because, you can only say, items that are ina  specific state (all)

Excute the following rule.

 

So it doesnt look like you can do, if qty = 10 then add row 10 times. 

 

 

Reply