A Notes UI for ordering a list

Create a list of items and a UP and a DOWN button that you can click to move a selected item up and down in the list w/Notes.

You've seen application where there is a list of items and a UP and a DOWN button which you can click to move a selected item up and down in the list. This tip show you how to do it in Notes.
If you want to do the same in a browser, you can use JavaScript.
This tip uses Notes formula.

All fields in this tip are editable.

Create a form, say test.
Create a text field called "values", and allow multiple values.
You can hide this field.
Create a Listbox (could be any other keywords type fields) field called leftBox.
Allow multiple values for this field. Change the height to 2 to make it looks like a box.
Use formula for choices. For this test form, I hard coded a couple of choices.
Create a Listbox field, rightBox.
Don't allow multiple values! (If you allow multiple values, the formula to move items up and down will be dramatically complicated).
Use formula for choice for rightBox. The formula is "values".
Check Refresh choices on document refresh. This is important.
Create three buttons.
The first button adds selected items from the leftBox to the rightBox.
The second button moves a selected item in the rightBox up.
The third button moves a selected item in the rightBox down.

Formula for the first button:

 @SetField("Values"; @Unique(values : leftBox)); @Command([ViewRefreshFields])

Formula for the second button:

 sep := "#*#"; selected := rightBox; @If(selected = ""; @Return(""); ""); oldvalues := " " + sep + @Implode(Values; sep) + sep + " "; l1 := @Left(oldvalues; sep + selected + sep); @If(l1 = " "; @Return(""); ""); l2 := @Right(oldvalues; sep + selected + sep); l3 := @LeftBack(l1; sep); l4 := @RightBack(l1; sep); l5 := l3 + sep + selected + sep + l4 + sep + l2; @SetField("Values"; @Trim(@Explode(l5; sep))); @Command([ViewRefreshFields])

Formula for the third button:

 sep := "#*#"; selected := rightBox; @If(selected = ""; @Return(""); ""); oldvalues := " " + sep + @Implode(Values; sep) + sep + " "; l1 := @Left(oldvalues; sep + selected + sep); l2 := @Right(oldvalues; sep + selected + sep); @If(l2 = " "; @Return(""); ""); l3 := @Left(l2; sep); l4 := @Right(l2; sep); l5 := l1 + sep + l3 + sep + selected + sep + l4; @SetField("Values"; @Trim(@Explode(l5; sep))); @Command([ViewRefreshFields])
This was first published in February 2002
This Content Component encountered an error

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close