Message Boards Message Boards

Formatting output in Wolfram Cloud?

I'm struggling with how to format the output of the function in a FormPage published using CloudDeploy. My form works, and my executed function generates the text output I expect, but none of my attempts to format it are working. Everything works fine in the Notebook interface, but is ignored or has otherwise unexpected results.

My form accepts four integers, each restricted to 1-9. When the form is submitted, a simple function is called with those four digits as input. The output of the function is a list of lists of strings and integers, e.g.

{{"(5+(7-8))*6", " == ", 24}, {"(5+7)*(8-6)", " == ", 24}, {"(5-(8-7))*6", " == ", 24}}

At first, I was hoping to convert these constructed string "equations" to TraditionalForm expressions using ToExpression and HoldForm, which works fine in the Mathematica Notebook environment, but breaks in the Wolfram Cloud. Instead, each equation is the string just wrapped in "HoldForm[...]".

Next, I decided to just accept that I wouldn't get that working, and work instead with the strings, perhaps formatting the output in a nicer fashion using Grid with options like Frame, Alignment, Background, etc. Again, this works just fine in the Notebook environment, but breaks in Wolfram Cloud. The Grid function appears to be ignored completely.

Is there any good documentation available on how to format output for display in code deployed to the Wolfram Cloud using CloudDeploy and FormObjects?

Thank you!

POSTED BY: Christopher Fox

One possibility is to convert each equation to a graphic:

Rasterize[TraditionalForm[HoldForm[(5 + (7 - 8))*6 == 24]]]

Any of the HTTPResponse functions found in its documentation examples should also work as a FormPage second argument.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract