Work Fields With Multivalue In Formula - Dynamic Table

tree button for work with fields multivalues in a table (script is not
requerid)
3 buttom (add, Change, Del)
the form has tree (3) field (multivalues) Field01, Field02, Field03
the form (dialogbox1) has tree fields (HField01, HField02, HField03)
ADD
FIELD HField01 := "" ;
FIELD HField02 := "" ;
FIELD HField03 := "" ;
okcancel := @DialogBox( "DialogBox1" ; [AutoHorzFit] : [AutoVertFit] ; "Add
Information") ;
@If(okcancel = 0; @Return("") ; @Success) ;
FIELD Field01 := @If(Field01 = "" ; HField01 ; Field01 : HField01) ;
FIELD Field02 := @Trim(Field02 : HField02) ;
FIELD Field03:= @If(Field03 = "" ; HField03 ; Field03 : HField03 ) ;

CHANGE
FIELD HField01 := "" ;
FIELD HField02 := "" ;
FIELD HField03 := "" ;
@If(@Elements(Field01) = 0; @Return(@Prompt([OK]; "Error "; "No rows for
change. Process Cancel.")); @Success);
numbers := "0" : "1" : "2" : "3" : "4" : "5" : "6" : "7" : "8" : "9";
LineItem := @Subset(@Subset(@Text(@TextToNumber(numbers *+ numbers)); -99);
@Elements(Field01));
ModElement := @Prompt([OKCANCELLIST] : [NoSort]; "Modificar Fila"; "Choice a
row for change; @Subset(LineItem; 1) + ". " + @Subset(@Text(Field01);1);
LineItem + ". " + @Text(Field01) + " " + Field02);
@If(@IsError(@Trim(ModElement)); @Return(@Prompt([OK]; "Error "; "Don?t choice
a row. Process cancel.")); @Success);
Selection := @TextToNumber(@Word(ModElement;". ";1));
FIELD HField01 := @Subset(@Subset(Field01; Selection); -1);
FIELD HField02 := @Subset(@Subset(Field02; Selection); -1);
FIELD HField03 := @Subset(@Subset(Field03; Selection); -1);
okcancel := @DialogBox("DialogBox1"; [AutoHorzFit] : [AutoVertFit];"Change
information" );
@If(okcancel = 0; @Return(""); @Success);
PlaceInList := @Member(@Text(Selection); LineItem);
FirstElementsNum := PlaceInList - 1;
LastElementsNum := (@Elements(LineItem) - PlaceInList) * -1 ;
FirstA := @If(FirstElementsNum = 0; ""; @Subset(Field01; FirstElementsNum));
LastA := @If(LastElementsNum = 0; ""; @Subset(Field01; LastElementsNum));
FIELD Field01 := @If (FirstA = "" ; HField01 : LastA ; LastA = "" ; FirstA :
HField01 ; FirstA : HField01 : LastA ) ;
FirstB := @If(FirstElementsNum = 0; ""; @Subset(Field02; FirstElementsNum));
LastB := @If(LastElementsNum = 0; ""; @Subset(Field02; LastElementsNum));
FIELD Field02 := @Trim(FirstB : HField02 : LastB);
FirstC := @If(FirstElementsNum = 0; ""; @Subset(Field03; FirstElementsNum));
LastC := @If(LastElementsNum = 0; ""; @Subset(Field03; LastElementsNum));
FIELD Field03 := @If (FirstC = "" ; HField03 : LastC ; LastC = "" ; FirstC :
HField03 ; FirstC : HField03 : LastC ) ;
""

DEL

@If(@Elements(Field01) = 0; @Return(@Prompt([OK]; "Error "; "No rows for
delete. Process cancel.")); @Success);
numbers := "0" : "1" : "2" : "3" : "4" : "5" : "6" : "7" : "8" : "9";
LineItem := @Subset(@Subset(@Text(@TextToNumber(numbers *+ numbers)); -99);
@Elements(Field01));
DeleteElement := @Prompt([OKCANCELLIST]; "Del row"; "Choice a row for delete:
"; @Subset(LineItem; 1) + ". " + @Subset(@Text(Field01);1); LineItem + ". " +
@Text(Field01));
@If(@IsError(@Trim(DeleteElement)); @Return(@Prompt([OK]; "Error "; "Don?t
choice a row. Process cancel.")); @Success);
Selection := @TextToNumber(@Word(DeleteElement;". ";1));
PlaceInList := Selection;
FirstElementsNum := PlaceInList - 1;
LastElementsNum := (@Elements(LineItem) - PlaceInList) * -1;
FirstA := @If(FirstElementsNum = 0; ""; @Subset(Field01; FirstElementsNum));
LastA := @If(LastElementsNum = 0; ""; @Subset(Field01; LastElementsNum));
FIELD Field01 := @If (FirstA = "" ; LastA ; LastA = "" ; FirstA ; FirstA :
LastA ) ;
FirstB := @If(FirstElementsNum = 0; ""; @Subset(Field02; FirstElementsNum));
LastB := @If(LastElementsNum = 0; ""; @Subset(Field02; LastElementsNum));
FIELD Field02 := @Trim(FirstB : LastB);
FirstC := @If(FirstElementsNum = 0; ""; @Subset(Field03; FirstElementsNum));
LastC := @If(LastElementsNum = 0; ""; @Subset(Field03; LastElementsNum));
FIELD Field03 := @If (FirstC = "" ; LastC ; LastC = "" ; FirstC ; FirstC :
LastC ) ;
""
This was first published in November 2000

Dig deeper on Domino Resources - Part 6

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

SearchWinIT

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

SearchVirtualDataCentre.co.UK

Close