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

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

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.