Loop variables inside the "for every record" construct

Suggestions for new functionality in NiceLabel. Do you want some feature but can't find it in the NiceLabel software? Post your wish here. Note: This is not a support forum.

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Posts: 14
Joined: Fri Apr 20, 2018 1:58 pm

Loop variables inside the "for every record" construct

Post by FunDeckHermit » Wed Jun 20, 2018 9:13 am

Hello everyone,

When trying the "for every record" contruct in Nicelabel 2017 Powerforms it struck me that I couldn't use/reference the variables.

What I suggest is some way of creating a limited scope variable inside the "for every record" construct. A loop variable.

In C# this would look something like this:

Code: Select all

     List<string> myCollection = new List<string>() { "strawberry", "apple", "berry", "banana", "kiwi" };
     foreach(string fruit in myCollection)
         //Do something with the fruit


User avatar
Posts: 2949
Joined: Mon Sep 04, 2006 8:09 am

Re: Loop variables inside the "for every record" construct

Post by Saso » Tue Jun 26, 2018 11:35 am

The name-value pairs that you receive from running the Execute SQL Statement action are automatically mapped to the trigger variables of the same name.

For example, if you have a SQL statement like the following:

Code: Select all

SELECT field_one, field_two FROM Table
You will receive a CSV-like structure as a result:

Code: Select all

If you have two trigger variables defined with names field_one and field_two (matching names received from SQL), those variables will automatically be assigned with values from SQL (for each instance/loop the variables will receive values from the current row in a returned dataset).

Code: Select all

For 1st row: field_one=1, field_two=A
For 2nd row: field_one=2, field_two=B
Just make sure the names of SQL fields and trigger variables are the same.
Saso Fleiser
Senior Technical Product Specialist

Post Reply