8
$\begingroup$

I have a Mathematica Enterprise notebook which takes user input:

*The input numbers are assigned to the variables nV, nL, nZ, nD*)
Clear[nV, nL, nZ, nD];
(*set default values*)
{nV, nL, nZ, nD} = {8, 12, 600, 10};
TableForm[{
{PopupMenu[Dynamic[nV], Range[2, 20, 2]]},
{PopupMenu[Dynamic[nL], Range[100]]},
{PopupMenu[Dynamic[nZ], Range[3000]]},
{PopupMenu[Dynamic[nD], Range[100]]}},
TableHeadings ->
{{"(a) planned total number of positive and negative test voltages \
for each device", 
"(b) planned number of test locations for each device",
"(c) planned number of zaps for each device",
"(d) planned number of devices to be tested"}, None}]

I go to menu "File/CDF preview" and a yellow bar appears at the top of the notebook which says "Enterprise CDF Preview...Export CDF." I click on "Export CDF" and a CDF of the notebook is created. Then I open CDF Player and open the CDF. But the CDF will not run the cell that takes user input! The same problem happens when I "Save As" *.cdf. I was able to create CDF that could take user input in an earlier version of Mathematica Enterprise. Why doesn't it work now?

$\endgroup$
6
$\begingroup$

I find it necessary to use the CDFDeploy function to get Enterprise CDF functionality in 11.2.

I have this defined in a separate notebook:

cdf[notebook_, file_] := Block[{},
  SetOptions[notebook, PrivateNotebookOptions -> {"ShowProductBranding" -> False}];
  CDFDeploy[file, notebook, "Target" -> "PlayerPro", Deployed -> False]]

Then I just need to find the correct notebook in the output of Notebooks[] and cdf it:

Notebooks[]
(* {NotebookObject["Deploy CDF.nb"], NotebookObject["Untitled-1"], NotebookObject["Messages"]} *)

%[[2]] ~cdf~ "myfile.cdf"
$\endgroup$
  • 1
    $\begingroup$ Can you explain the apparently redundant "Block" ? $\endgroup$ – fairflow Jan 6 '18 at 15:33
  • 1
    $\begingroup$ @fairflow, it's just that I prefer to use an explicit Block or Module wrapper around a series of evaluations, rather than brackets. It makes it more obvious (to me anyway) that both lines of code are part of the function definition. $\endgroup$ – Simon Woods Jan 6 '18 at 15:40
  • 1
    $\begingroup$ ah. got it. thanks. $\endgroup$ – fairflow Jan 7 '18 at 17:39
4
$\begingroup$

I contacted Wolfram Technical Support. They said the menu commands to create an Enterprise CDF do not create an Enterprise CDF! They were already aware of this problem. Their workaround is to create a new notebook containing the cell:

filepath1 = FileNameJoin[{NotebookDirectory[], "notebookname.cdf"}];
filepath2 = FileNameJoin[{NotebookDirectory[], "notebookname.nb"}];
CDFDeploy[filepath1, filepath2, Deployed -> False];

in the same directory as your Enterprise notebook "notebookname.nb", then evaluate the new notebook. This will create an Enterprise CDF named "notebookname.cdf" that will work in CDF Player.

$\endgroup$
  • 1
    $\begingroup$ It should work so I will mark this issue as a bug. $\endgroup$ – Kuba Dec 12 '17 at 9:40
  • 2
    $\begingroup$ would be nice if minor versions didn't introduce major new bugs! $\endgroup$ – fairflow Dec 16 '17 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.