How Can We Help?
Answer
Background: Below is a screen shot of the Booking activityA specific step in a process. It will be the user interface for that step (web form or a screen), for example, the Leave Application (screen interface or web form) will be the first Activity in the Leave Requisition process. The Leave Application Authorization will be the second step or Activity in the Leave Requisition process. One Process can have multiple activities. for a Travel Reservation process.
During the first activity (Request Travel), the user will enter the names of the person(s) who will be traveling.
These values will get passed from the Request activity to the Book Travel activity.
When the booking agent is entering the booking information, they will have to select for which traveler the arrangement is for.
Objective: concatenate first, middle, and last name as a full name from two different object groups and add them as items to a drop down
**You can make this work for either On Refresh or On Load.
It’s just a matter of where you place the code and how you want it to work.
In the example below, it’s placed On Load because the names have already been populated from a previous activity.
public void DropDown_OnLoad() { string FullName = String.Empty; string ResultSet = String.Empty; ObjectGroup grp = activity.ObjectGroups.NamedItem("ObjectGroup1"); //This is the first (1/2) object group that contains the names. It's populated from a previous activity. for(int index = 0; index <= grp.Lines - 1; index++) //Here, for every row in the object group, we are concatenating first, middle, and last name and returning one string. { FullName = activity.GetControlValue("FirstName1", grp.ID, index) + ' ' + activity.GetControlValue("MiddleName1", grp.ID, index) + ' ' + activity.GetControlValue("LastName1", grp.ID, index); ResultSet = ResultSet + FullName; if (index != grp.Lines) ResultSet = ResultSet + ";"; //This will separate every item in the drop down } if (activity.GetControlValue("Checkbox") == "True"); //This is a check box that toggles the visibility of a second object group that may or may not contain names. It's populated from a previous activity. If the checkbox is true, then we proceed to concatenate a second set of names. { ObjectGroup grp2 = activity.ObjectGroups.NamedItem("ObjectGroup2"); for(int index = 0; index <= grp2.Lines - 1; index++) { FullName = activity.GetControlValue("FirstName2", grp2.ID, index) + ' ' + activity.GetControlValue("MIddleName2", grp2.ID, index) + ' ' + activity.GetControlValue("LastName2", grp2.ID, index); ResultSet = ResultSet + FullName; if (index != grp2.Lines) ResultSet = ResultSet + ";"; } } ObjectGroup grp3 = activity.ObjectGroups.NamedItem("DestinationObjectGroup"); //This is the object group that contains the destination drop down grp3["DestinationDropDown"].Options["Items"] = ResultSet; }
Comments are closed.