Permit Records & Deletion of Information List Type in Multivalue Field w/Verifying Selection

Permit records and deletion of information list type in multivalue field with verifying the selection. If we have

a database drjusers.nsf which had the records the employers (with IDs) and their groups we can make lists with this information like a table.


Fields in form:
iNrcrt - Text
sData - Data
sOra - Data
sCodElRetea - Text

Button New ? record a information in the table

@Command( [EditDocument];"1" );

var1 := @Word(@Implode(@DbName;";"); ";"; 2);
var2 := @LeftBack(var1;13)+"drjusers.nsf";
sMvuCauza:=@UpperCase(sMVU);
var3:=sMvuCauza+"RE?A";
var4 := @Word(@Implode(@DbName;";"); ";"; 1);

sFormatiaElReteaTemp := @Prompt([OKCANCELLIST]; " Group";
"Select the group:";"";(@Unique(@DbLookup("":"NoCache";var4:var2;".AppCauzaFormatiaKeyword";var3;2))));

sFormatiaElRetea:=@If(sFormatiaElReteaTemp=1;@Do(@Set(sData;""):@Set(sOra;""):@Prompt([OK];"Attention";"You don?t select the group; Repeat the procedure"):@Return("")); sFormatiaElReteaTemp);
var5:=var3+sFormatiaElRetea;

sNumeElReteaTemp :=@If(sFormatiaElRetea="";""; @Prompt([OKCANCELLIST]; " Person"; "Select the name of the person:";"";(@DbLookup("":"NoCache";var4:var2;".AppCauzaNumeKeyword";var5;2))));
sNumeElRetea:=@If(sNumeElReteaTemp=1;@Prompt([OK];"Attention";" You don?t select the person; Repeat the procedure"):@Return(""); sNumeElReteaTemp);

var7:=var5+sNumeElRetea;
sCodElReteaTemp := @DbLookup("":"NoCache";var4:var2;".AppCauzaCodKeyword";var7;2);
sFinalElReteaTemp:=@If(sCodElReteaTemp="";@Prompt([OK];"Attention";"Missing ID; Repeat the procedure"):@Return(""); sCodElReteaTemp+" "+sNumeElRetea);

FIELD sData:=@Explode(@Implode(sData;@NewLine)+@NewLine+sDataTemp);
FIELD sOra:= @Explode(@Implode (@Text(sOra);@NewLine)+@NewLine+sOraTemp; @NewLine);
FIELD sCodElRetea:=@Explode(@Implode(sCodElRetea;@NewLine)+@NewLine+sFinalElReteaTemp; @NewLine);

@Command([ToolsRunMacro]; "(.AppNrCrt)");
@Command([ToolsRunMacro]; "(.AppRefreshDocument)");
1

Button Delete ? delete a record from the table

@Command( [EditDocument];"1" );

curentaTemp := @Prompt([OKCANCELLIST] : [NoSort]; "Delete record"; "Select a record to delete:"; ""; iNrCrt);

curenta:=@If(curentaTemp=1;@Prompt([OK];"Attention";"You must select a record; Repeat the procedure"):@Return(""); curentaTemp);

n := @Member(curenta; iNrCrt);
FIELD PozitieTemp:=@Text(n);
nrelemente:=@Elements(iNrCrt);
FIELD NrelemTemp:=nrelemente;

inaintesData := @If(n =1;""; @Subset(sData; n-1));
dupasData :=@If(nrelemente = n;""; @Subset(sData; -(nrelemente - n))); FIELD sData:=@Explode((@Implode(inaintesData;@NewLine)+@NewLine+@Implode(dupasData;@NewLine));@NewLine);

inaintesOra := @If(n =1;""; @Subset(sOra; n-1));
dupasOra :=@If(nrelemente = n;""; @Subset(sOra; -(nrelemente - n)));
FIELD sOra:=@Explode((@Implode(@Text(inaintesOra);@NewLine)+@NewLine+@Implode(@Text(dupasOra);@NewLine));@NewLine);

inaintesCodElRetea:= @If(n =1;""; @Subset(sCodElRetea; n-1));
dupasCodElRetea :=@If(nrelemente = n;""; @Subset(sCodElRetea; -(nrelemente - n)));
FIELD sCodElRetea:=@Explode((@Implode(inaintesCodElRetea;@NewLine)+@NewLine+@Implode(dupasCodElRetea;@NewLine));@NewLine);

@Command([ToolsRunMacro]; "(.AppNrCrtMod)");
@Command([ToolsRunMacro]; "(.AppRefreshDocument)")

Agent AppNrCrt ? generating a current number for the row in the table

Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument
Set doc=uidoc.document

Dim values, item1
Set item1 = doc.GetFirstItem("iNrCrt")
values = item1.Values
nrelem=Ubound(values)
ultim=values(nrelem)
If ultim="" Then
ultim="0"
End If
ultim=Cstr(Cint(ultim)+1)

For i=0 To Ubound(values)
If i=0 Then
final=final & values(i)
Else
final=final & Chr(13) &values(i)
End If
Next i

If final="" Then
final=ultim & Chr(13)
Else
final=final & Chr(13) & ultim
End If
doc.iNrcrt=final
End Sub

Agent AppNrCrtMod ? delete the number row of a table when we delete a record (maintain the numbers rows)

Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument
Set doc=uidoc.document

Dim values,valuesData,valuesOra, item1,Data1,Ora1,Nume1,valuesnume
pozitie=Cint(doc.pozitieTemp(0))
elemente=Cint(doc.NrelemTemp(0))
Set item1 = doc.GetFirstItem("iNrCrt")
Set nume1 = doc.GetFirstItem("sCodElRetea")

Set Data1 = doc.GetFirstItem("sData")
Set Ora1 = doc.GetFirstItem("sOra")

values = item1.Values
valuesData =Data1.Values
valuesnume=nume1.Values
valuesOra = Ora1.Values
nrelem=Ubound(values)

For i=0 To Ubound(values)
' primul element
If i=0 Then
final=final & values(i)
Else
'nu e primul element
If i<(pozitie-1) Then
final=final & Chr(13) &values(i)
Else
'ultimul si mai mult de 2 elemente
If i>(pozitie-1) And i>1 Then
final=final & Chr(13) &Cstr(Cint(values(i))-1)
Else
'ultimul si sunt doua elemente
If i>(pozitie-1) And i=1 Then
final=Cstr(Cint(values(i))-1)
End If
End If
End If
End If
Next i

If elemente=1 Then
final=""
End If

doc.iNrcrt=final
End Sub

Agent AppRefreshDocument ? refresh the current document

Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Call uidoc.Refresh
End Sub

This was first published in March 2001

Dig deeper on Domino Resources - Part 5

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:

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