Extracting object value
# 🤝help
l
does anyone know how to extract values of workflow variable to text? when i use {{workflow.diagnosis1}} or @diagnosis1 for example it outputs like a json file, im trying to use execute code to try to extract it but causes an error

https://cdn.discordapp.com/attachments/1131399293597651065/1131399293723488346/Screenshot_2023-07-20_092503.png

https://cdn.discordapp.com/attachments/1131399293597651065/1131399293945774192/Screenshot_2023-07-20_092714.png

here's the current output without the extract code:

https://cdn.discordapp.com/attachments/1131399293597651065/1131422186360553613/image.png

f
Hi @limited-forest-26830 ! the
@diagnosis1
variable is an object with multiple properties. If for example you need to access the description of the diagnosis, you would need to use an expression (the one with curly {} brackets, rather than using the @ variable syntax), and access the
.description
property, for example:
Copy code
{{ workflow.diagnosis1.description }}
l
right, okay im getting an idea with that
is there a way to display all properties as one?
f
Sure, could you give me an example of how you need the text displayed?
l
Similar to this:

https://cdn.discordapp.com/attachments/1131399293597651065/1131422677702287441/image.png

thats the previous result before, my current one has the ability to store each diagnosis in a variable, that result was when I purely depended on ai task generation without storing it individually
but yeah, im thinking if i want to keep that format i might have to use individual expressions to style it
f
I see, you could use something like this in a text card:
Copy code
1. {{ workflow.diagnosis1.diagnosis }} - {{ workflow.diagnosis1.probability + '%' }}
{{ workflow.diagnosis1.description }}

2. {{ workflow.diagnosis2.diagnosis }} - {{ workflow.diagnosis2.probability + '%' }}
{{ workflow.diagnosis2.description }}

3. {{ workflow.diagnosis3.diagnosis }} - {{ workflow.diagnosis3.probability + '%' }}
{{ workflow.diagnosis3.description }}
l
great!
ill try it out thanks Abe
15 Views