Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

LS? We don't use no LS

This is all function code. See the 'more info' post for, well, more info on what's going on. It really looks to me like the stuff I'm doing just before I run this code somehow causes Notes to lose track of the parent UNID, like the view index is screwed but I'm not doing any full text stuff but it somehow matters.

Enjoy and thanks for sticking with this.

Doug

REM {Abort if CalPerformedBy, CompleteDate, InOutOfTolerance, and asRetInOutOfToleranceare not all set};
@StatusBar("Starting Save & Schedule Next Cal at: " + @Text(@Now) + " -------------------------------");

@If(
(
(CalPerformedBy != "" & CompleteDate != ""& InOutOfTolerance != "")
);
@Success;
@Return(@Prompt([Ok];"Error";"You must set the name of the calibrator, date cal'd, and in/out of tolerance to save this record")));

whereFrom := @Environment("whereFrom");
@StatusBar("whereFrom: " + whereFrom);

REM {Establish next due date - last cal + interval};
nextCalDate := @Adjust(CompleteDate;0;StandardCalInterval;0;0;0;0);

REM {PreventEscapeSave is used to force user to press the save button rather than <esc>};
@StatusBar("Ready to save doc");
@SetField("PreventEscapeSave"; "save");
@Command([FileSave]);
@StatusBar("Doc saved");
parentID := @Text($Ref);
@StatusBar("parent doc id: " + parentID);
@StatusBar("EquipmentStatus before we create new cal = " + EquipmentStatus);
@StatusBar("CurrentLocation before we create new cal = " + CurrentLocation);
@SetEnvironment("initStatus"; EquipmentStatus);
@SetEnvironment("initLoc";CurrentLocation);
@SetEnvironment("initID";parentID);

REM {We now want to return the user to the view so we look at how the user got to the cal doc};
REM {If they came from the view, we just close this doc and then build the next};
REM {If they cam from the parent (where From is set to doc when the parent is opened), we };
REM { set the ini var back to view, close twice (this doc and parent), then build the new cal doc from the view};
@If(whereFrom = "view";
@Do(
@StatusBar("coming from view, return to view - close window once");
@Command([CloseWindow]));
@Do(
@StatusBar("coming from doc, close window twice: return to parent doc then return to view and set wherefrom back to view");
@SetEnvironment("whereFrom";"view");
@Command([CloseWindow]);
@Command([CloseWindow])));

@StatusBar("build next cal");
@Command([Compose];"frmCalData");
@UpdateFormulaContext;
FIELD DueDate := nextCalDate;
FIELD DueDateReasonChange := "";
@SetField("PreventEscapeSave"; "save");
@Command([FileSave]);
@Command([CloseWindow]);
@StatusBar("new cal built, saved, and closed");

REM {This code saves and closes the child, then opens and updates the parent if required};
REM { The parent UI is saved which pushes all changes down to all child docs};
REM { Metacode for the parent update};
REM { If equipmenStatus = 'Inactive', don't update parent};
REM { If equipmenStatus = 'Lost', don't update parent};
REM { If currentLocation = 'Not In Use', ask the user for the value of the newLocation};
REM { If currentLocation != 'Not In Use, then newLocation = 'In Use'};
REM { equipmentStatus = 'Active};
REM { Open parent and set currentLocation = newLocation and equipmentStatus = 'Active'};
initStatus := @Environment("initStatus");
initLoc := @Environment("initLoc");
initID := @Environment("initID");

@StatusBar("Starting parent processing evaluation");
@StatusBar("EquipmentStatus = " + initStatus);
@StatusBar("CurrentLocation = " + initLoc);
@StatusBar("parentID = " + initID);

REM {If the parent location is not In Process or EquipmentStatus not Active, then update the parent and all child docs};

@If(
initStatus = "Inactive";
@Return(@StatusBar("Abort - parent is Inactive so parent not updated"));
@Success);

@If(
initStatus = "Lost";
@Return(@StatusBar("Abort - parent is Lost so parent not updated"));
@Success);

newLocation :=
@If(
initLoc = "Not In Use";
@Prompt([OkCancelList];"New Location?";"Select the new location for this part";initLocation; "In Use" : "Not In Use");
"In Use");

@StatusBar("computed newLocation = " + newLocation);

REM {Update parent if required then save it and force changes into child docs};
@Command( [OpenDocument] ; "1" ; initID);

@UpdateFormulaContext;
@StatusBar("Parent doc should be open");
@StatusBar("Expected UNID of parent doc from ini file: " + initID);
@StatusBar("Actual id of curent doc: " + @Text(@DocumentUniqueID));

REM {need to add conditions related to location and status and only run this if required};
REM {Only change the current location if the item is out for cal};
@SetField("CurrentLocation"; newLocation);
msgTxt1 := "Parent location set to '" + newLocation + "'";
@StatusBar("Post setField. " + msgTxt1);
@SetField("EquipmentStatus"; "Active");
msgTxt2 := "Parent Status set to 'Active'";
@StatusBar("Post setField. " + msgTxt2);

@SetField("PreventEscapeSave"; "save");
@If(msgTxt1 != "" | msgTxt2 != "" ;
@Prompt([Ok];"Parent Updated";msgTxt1 + " " + msgTxt2);
@Success);
@StatusBar("Parent Updated " + msgTxt1 + " " + msgTxt2);
@StatusBar("end of Save & Schedule Next Cal at: " + @Text(@Now) + " ********************************");

@PostedCommand([FileSave]);
@PostedCommand([CloseWindow]);
@PostedCommand([ViewRefreshFields])


Feedback response number WEBB9TDNRP created by ~Hank Lopvelutergon on 02/03/2015

@command(OpenDocument] by unid some... (~Martha Lopjipy... 28.Jan.15)
. . More info (~Martha Lopjipy... 28.Jan.15)
. . 'optimize document table map' (~Sigmund Dworel... 28.Jan.15)
. . . . Nope, not set (~Martha Lopjipy... 28.Jan.15)
. . . . . . Could you post the LS code? (~Judy Ektumizen... 2.Feb.15)
. . . . . . . . LS? We don't use no LS (~Martha Lopjipy... 3.Feb.15)
. . . . . . . . . . Code (~Dan Kikiterobu... 3.Feb.15)
. . . . . . . . . . . . I see the cornfusion (~Martha Lopjipy... 4.Feb.15)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS