Hey all, I have a SQL database linked and running a query that outputs a payload and I am able to select it individually by msg.payload.rows[0] etc, but when trying to display it on the UI I can't figure out how to display just the value inside quotations. Any assistance would be greatly appreciated!
show the output of debug 1. copy and paste.
Your problem will be made a bit simpler if you change your query a bit
SELECT blah, blah, SUBSTR(CNTR_DESC, 1, 8) AS desc, blah, blah from blah...
The value "1G030142" then becomes msg.payload.rows[0].desc
or (in a template) msg.payload.rows.0.desc
Edit: desc
is no doubt a reserved word. Use some other alias eg shortdesc
SELECT * FROM ( SELECT DISTINCT substr(cntr_desc, 1, 8) FROM v_rt_shift_oee_calc ORDER BY DBMS_RANDOM.RANDOM) WHERE rownum < 11 : msg : Object
object
payload: object
metaData: array[1]
rows: array[10]
0: object
1: object
2: object
3: object
4: object
5: object
6: object
7: object
8: object
9: object
topic: "SELECT * FROM ( SELECT DISTINCT substr(cntr_desc, 1, 8) FROM v_rt_shift_oee_calc ORDER BY DBMS_RANDOM.RANDOM) WHERE rownum < 11"
event: object
socketid: "X1rZgd20towjSWsqAAAF"
_msgid: "1ba0387e7ae4baf6"
sorry, i wasn't clear. open any one object completely of the debug output and paste the value.
also, if you could follow @jbudd advice, the result will be simpler to implement
rows: array[10]
0: object
SUBSTR(CNTR_DESC,1,8): "1H080104"
1: object
2: object
SUBSTR(CNTR_DESC,1,8): "1B010211"
sorry forgot to ask, is this dashboard 1 or dashboard 2.0 ?
assuming, dashboard 1,
try this in the ui-text
[{"id":"91326ae9c1b76ad6","type":"ui_text","z":"4cde86148e5b95f7","group":"6339e2ead216512f","order":4,"width":0,"height":0,"name":"","label":"","format":"{{payload[0]SUBSTR(CNTR_DESC,1,8)}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":775,"y":1600,"wires":[]},{"id":"6339e2ead216512f","type":"ui_group","name":"Group 2","tab":"5e0dd10e66fdea95","order":2,"disp":false,"width":"30","collapse":false,"className":""},{"id":"5e0dd10e66fdea95","type":"ui_tab","name":"TEST","icon":"dashboard","order":9,"disabled":false,"hidden":false}]
also if you would have followed @jbudd advice, it would have been simpler.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.