Manage Learn to apply best practices and optimize your operations.

@replace function for JavaScript

This tip describes how to use the @replace function with JavaScript.

A javascript function which functions the same as the @replace function

 function replace(sourcelist,fromlist,tolist) { //@Replace( sourcelist ; fromlist ; tolist ) //fromlist and tolist need to be array's if (fromlist[0]==null || tolist[0]==null) { alert('fromlist and tolist needs to be arrays') return sourcelist } for (i = 0; i < fromlist.length; i++ ) { //Firt check if sourcelist is array or string if (sourcelist[0]==null) { // IsString if (fromlist[i] == sourcelist) return tolist[i]; } else { // IsArray for (j=0; j < sourcelist.length;j++) { if (fromlist[i] == sourcelist[i]) sourcelist[i] = tolist[i]; } } } return sourcelist }

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 ...