Skip to main content
10-Marble
October 21, 2025
Solved

Dependent Listbox doesn't retain value on save and then open

  • October 21, 2025
  • 1 reply
  • 1030 views

I have two list boxes (MathCAD Prime 11.0.0.0), The selection of one list box drives the list of the other box (see picture). The problem I have is the values update on re-opening the sheet. I can get the sheet to remember the 'Type' selection. However I can't get the second list box to remember the selection from the previous save and close. Below is the code in the jscript:-

 
// TODO: Add your initialization code here
ListBox.ResetContent();
// Add Strings here as needed
 
function ListBoxEvent_Start(Inputs, Outputs) {
   // TODO: Add your code here
ListBox.ResetContent()
if(Inputs[0].Value=="UC"){
ListBox.AddString("356 x 406x 1299");
ListBox.AddString("356 x 406x 1202");
ListBox.AddString("356 x 406x 1086");
ListBox.AddString("356 x 406x 990");
... (the full script code is attached)
So I know/suspect the issue is the 'ListBox.ResetContent()' line but how do I stop the script running on open or remembering the selection, so that it keeps the previous save options?
The sheet options are shown in the screen grab 'sheet options selections.png', I have seen that if items in this list to do with scripts could be a solution, but the check options don't look they would help as they are to run scripts.
Any ideas?
Best answer by DJNewman

I just got a new update on this from the Mathcad team...

 

JScript and Python controls with ORIGIN = 1
• This is a bug that surfaced in Prime 11.0.1.0
• Workaround: Hard define ORIGIN to zero in the worksheet (ORIGIN:=0) before the first control then set it back to one after the control. If multiple controls in worksheet, then set it to zero before each control and reset to one after. 
• Will be fixed in Prime 12

 

I wish that our bug-fixing build didn't create a new bug (average software company experience), but what do you think about the workaround?

1 reply

DJNewman
18-Opal
October 21, 2025

With your Mathcad options of not running the Advanced Control script on worksheet open or recalculate, you can have, say, HEB selected on the first List Box and HEB320 retained on the second listbox upon saving, closing, and reopening the worksheet if you... upgrade to PTC Mathcad Prime 11.0.1.0.

 

This is one of the things that was fixed from 11.0.0.0 to 11.0.1.0. https://www.ptc.com/en/support/article/CS449753 

PTC Marketer for Creo and Mathcad. I run their YouTube channels, some Creo campaigns, and all Mathcad campaigns and communications.
sjupp10-MarbleAuthor
10-Marble
October 22, 2025

So the upgrade solved the issue with the advanced listbox's updating so that works ok. but now it requires the sheet ORIGIN to be set to '0'. we can obviously do this but have historically using the ORIGIN=1. I Tried updating this line "if(Inputs[0].Value=="UC"){" to be "if(Inputs[1].Value=="UC"){" with the view that I could keep the ORIGIN=1, but it doesn't work, I feel like I am missing something here? Or I suspect there is an issue here with the use of Jscript and compatibility with the calculation origin.

DJNewman
DJNewman18-OpalAnswer
18-Opal
October 23, 2025

I just got a new update on this from the Mathcad team...

 

JScript and Python controls with ORIGIN = 1
• This is a bug that surfaced in Prime 11.0.1.0
• Workaround: Hard define ORIGIN to zero in the worksheet (ORIGIN:=0) before the first control then set it back to one after the control. If multiple controls in worksheet, then set it to zero before each control and reset to one after. 
• Will be fixed in Prime 12

 

I wish that our bug-fixing build didn't create a new bug (average software company experience), but what do you think about the workaround?

PTC Marketer for Creo and Mathcad. I run their YouTube channels, some Creo campaigns, and all Mathcad campaigns and communications.