From MSDN: http://msdn.microsoft.com/en-us/library/aa884376(v=AX.50).aspx
"The Args class is used to pass arguments such as a name, a caller, and parameters between application objects."
For example, if a form opens up from another form (think ListPage form to non-list page), information about that first form can be passed to the second form that is being opened. Usually this is data like what form the second form is being opened from, any special data parameters, etc.
Anyways, with that prefacing out of the way...
NOTE: Italics below indicate an update to the original post. I think it will make more sense to what the post is showing.
The Problem: There is a requirement to pass a container from one form to another form and we cannot use args.parmObject() functionality as its already taken. For this example, we are trying to pass a set of record Ids. While containers can have other values, we're just going to use recIds so I can show a few other features.
The Issue: There is no way to pass a container through other means. There are options to pass a string, enum, record set, static string value, or object instance, but no container. The parmObject instance is unavailable but args.parm() which only takes a string and is available.
The Resolution: Here is how it was solved:
- Take the container and convert it a string with commas separating the variables
- Pass the string to the args().parm() call in the first object
- Retrieve the string from args().parm() in the second object
- Convert the string to a container
For point 4, we need to use the str2con function. str2con(str_value [, str 10 _sep, boolean _convertNumericToInt64] ). For an example, "str2con(strRecIds, ',', true)" would convert a string with commas as what distinguishes the individual components. The third parameter '_convertNumericToInt64' is really handy. It will take the string values and auto-convert them to an int64 (e.g. recId) when set to true.
Some code example:
IN FORM 1:
[Action: Highlighted a few records and clicked a button]
container conRecIds;
str strRecIds;
tmpTable = dataSource_DS.getFirst(1);
while (tmpTable.RecId != 0)
{
conRecIds += int642str(tmpTable.omRecID);
tmpTable = dataSource_DS.getNext();
}
strRecIds = con2Str(conRecIds, ',');
element.args().parm(strRecIds);
IN FORM 2:
container conRecIds;
str strRecIds;
strRecIds = args.parm();
conRecIds = str2con(strRecIds, ',', true);