-
Goal:
I am trying to set the output of a module, based on data in a custom map model. -
Steps:
I have tested every kind of query, checked the state of the custom model. It simply wont parse over. -
Details:
I am using a custom google maps api -
Screenshots:
-
App json export: (here's how to get a json export)
Hi @W_Seggos !
Although I couldn't find anything mentioned in the Retool docs on Module outputs that it requires Values to be strings, from my recent experience working with Retool Module outputs and looking at the Error message in your screenshot, I believe this is because what you're supplying as a Value (i.e. Map.model.areaSqFt
) is not a string.
What I'm doing to work around this is:
- use
JSON.stringify()
to stringify the value I want to use as Module output - use
JSON.parse()
in the app where I consume the Module output
So in your case, I would put {{ JSON.stringify(Map.model.areaSqFt) }}
in the Value for outputAreaSqFt
. Then when I want to use the module output in an app, I would do:
{{ JSON.parse(module.outputAreaSqFt) }}
to get it back to it's original type.
Here's an example app and module:
Example Module with Output using JSON.stringify.json (9.0 KB)
Example App Using Module with Stringified Output.json (12.9 KB)
Hope this helps!