"job-description" and Selecting Multiple Setups

"job-description" and Selecting Multiple Setups

jonathanBUCVS
Advocate Advocate
142 Views
1 Reply
Message 1 of 2

"job-description" and Selecting Multiple Setups

jonathanBUCVS
Advocate
Advocate

Specifically regarding the Excel setup sheet, I have been trying to duplicate the behavior of the workOffset variable that displays either the workOffset(if one setup is selected)  or "Multiple" (if more than one setup  is selected). 

 

//in the getProgramInfo() function
for (var i = 0; i < numberOfSections; ++i) {
    var section = getSection(i);
if (workOffset == undefined) {
      workOffset = section.workOffset;
    } else {
      if (workOffset != section.workOffset) {
        multipleWorkOffsets = true;
      }
    }
.....
// then output here
result["workOffset"] = multipleWorkOffsets ? "Multiple" : workOffset;

 I noticed in the documentation that getGlobalParameter() only grabs the first instance, so I did try to implement onParameter(). Ive tried a bunch of methods and locations, but Im out of ideas now and I dont think I understand the root cause of the issue to get to the exact answer. 

 

Im not necessarily looking for an exact solution, even a few ideas to play around with would be great.

 

 

 

0 Likes
143 Views
1 Reply
Reply (1)
Message 2 of 2

viacheslav.shapilov
Autodesk
Autodesk

Hi. Just some insights, how it works.

"job-description" is specified for the first section in the setup.

getProgramInfo function is called from onOpen before any section is specified.

You can use onParameter function to update current setup name. As I see, this function is defined in excel setup sheets already and collects all parameters. So, "job-description" should be already in cachedParameters for first section in setup. Not exactly, as for first setup it will go into programInfo.

Anyway, you can check, if there is "job-description" in cachedParameters in onSection callback and set 

programInfo["program.jobDescription"] to "Multiple", if it is. Or you can add new "job-description" to it, if you want to collect all setup names there. Also, you can add new property "setup" for sections.

Viacheslav Shapilov
Developer Technical Services
Autodesk Developer Network


0 Likes