Autor Thema: Sortierung mit AUF und AB  (Gelesen 1057 mal)

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Sortierung mit AUF und AB
« am: 30.03.03 - 01:58:16 »
habe das gefunden...@Axel...ist das nicht ne Lösung für Dein Prob, was wir beim ersten RL Treff mit der Dialogbox besprochen hatte, Werte von links nach rechts zu schieben?

Resource Type: Code  Times Read: 6
Language: @Function  
Title: A Notes Ui For Ordering A List
Submitted by: Andrew Barker on 14.05.2002


Lei Kuang

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.

Code

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])

(Quelle: http://www.andrewbarker.com/personal/barker/homepage.nsf/htmDocs/A_Notes_Ui_For_Ordering_A_List.htm )
« Letzte Änderung: 30.03.03 - 01:58:47 von Rob Green »
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

Offline Axel

  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 8.658
  • Geschlecht: Männlich
  • It's not a bug, it's Notes
Re:Sortierung mit AUF und AB
« Antwort #1 am: 31.03.03 - 08:27:43 »
Hi Rob,

danke für den Hinweis. Das Problem ist zwar im Moment vom Tisch, aber ich werde mir das mal zu Gemüte führen. Man kann ja nie wissen, ob' s dock noxh mal hochkocht.


Axel
Ohne Computer wären wir noch lange nicht hinterm Mond!

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz