Message Boards Message Boards

Displaying Databin as a Dataset table in a FormFunction Cloud Deployment

Posted 7 years ago

I am trying to set up a cloud deployed FormFunction where a user can enter a public databin ID and then view the contents formatted as a dataset. I keep running into issues where the output of the form returns straight text rather than the table I am looking for.

CloudDeploy[
 FormFunction[{"Databin ID:" -> <|
     "Help" -> "Enter the ID of a public Databin", 
     "Interpreter" -> "String"|>, }, 
  Dataset[Databin[#"Databin ID:"]] &], Permissions -> "Public"]

And here is a snippet of what I am getting in return when I try to view the databin as a dataset:

Dataset[{<|"Name" -> "Ben", "Email" -> "fake@gmail.com","Timestamp" -> DateObject[{2018, 5, 18, 12, 26, 55.98299980163574}, "Instant", "Gregorian", -7.]|><|"Name" -> "bob", "Email" -> "anotherfake@gmail.com","Timestamp" ->  DateObject[{2018, 5, 18, 12, 30, 33.210999965667725}, "Instant", "Gregorian", -7.]|>.....

I can replace

Dataset[Databin[#"Databin ID:"]]&` 

with this

ExportForm[Dataset[Databin[#"Databin ID:"]], "PNG"] &

and it will display an image of what I am looking for, but any other formatting option ("HTML", "WL", etc.) either fails or returns the same string of text as before

Any idea what I am missing?

POSTED BY: Ben Kickert
3 Replies
Posted 6 years ago

The more I look into this, the more I think it may be a bug instead of a coding issue. The reason being is that if I include the exact same code as above without using CloudDeploy in Mathematica, the result displays as expected with a Dataset table showing the databin contents. Furthermore, if I use the following code to simply CloudDeploy a Databin formatted as a Dataset, it also shows correctly.

CloudDeploy[Dataset[Databin["uI5TknW0"]]]

I just don't understand what would cause such a discrepancy with a CloudDeploy.

POSTED BY: Ben Kickert
Posted 6 years ago

After much trial and error, and eventually guidance from a kind soul on StackExchange, I was finally able to troubleshoot the problem. The fix was to use ExportForm to deploy it as a CloudCDF. I initially avoided this option because I thought it would require a CDF player installation for users. Here is the final working code:

CloudDeploy[
 FormFunction[{"Databin ID:" -> <|
     "Help" -> "Enter the ID of a public Databin", 
     "Interpreter" -> "String"|>, }, 
  ExportForm[Dataset[Databin[#"Databin ID:"]],"CloudCDF"] &], Permissions -> "Public"]

Still not sure why that option has to be set, but it is great to now know the fix.

POSTED BY: Ben Kickert
Posted 2 years ago

Hi Ben,

I don't know if you're still around but I thought I'd ask since I have a similar question.

If I want to deploy a form that takes one of the values (e.g., ID) in a databin as input and returns a dataset that contains the value. So your example took the databin identifier and return the whole dataset but I'd like the form to return a dataset of the input. Hope this makes sense and hope I could hear back..!

POSTED BY: Jack Oh
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