Manage Learn to apply best practices and optimize your operations.

Loop through several "Like" fields using For Loop

Many developers have a need to evaluate multiple "Like" fields within a single If statement or multiple If statements and find themselves duplicating the same If statement over and over again for each of the fields. This leaves them thinking, "I wish I could loop through all of these fields using a For loop."

For example, a 20-row table with a field in each row like this:
First row: Field1
Second row: Field2
Third row: Field3
and so on....

They are forced to script as follows:
If Field1 .... Then
If Field2 .... Then
and so on .... This can result in quite lengthy scripts.

Well now you can loop through these fields. Here's how:


 Code: ...set value of doc For i = 1 To 20 itemname = "Field"&Cstr(i) itemvalue = doc.GetItemValue(itemname) If itemvalue .... Then EndIf Next

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...