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 last published in November 2000

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-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