https://retellai.com/?utm_source=discord&utm_medium=seo logo
I am trying to set a memory variable in a node bas...
# ❓・ai-evy-support
t
@AI Evy I am trying to set a memory variable in a node based on another variable and it doies not work.
a
Thanks for tagging me @teddyf0595_18280. I'll look through relevant sources and get back to you shortly.
### Answer Based on the available sources, there are a few ways to work with variables in Retell AI's conversation flow system [(1) ]() [(2) ]() . For extracting and storing information as dynamic variables, you can use the Extract Dynamic Variable Node [(1) ]() . This node is specifically designed to extract information from conversation and store them as dynamic variables . When creating a variable, you need to fill in the Variable Name, Description, Variable Type, and Enum Options if applicable . The available variable types are : - Text - Any word or sentence. Examples:
"headache"
,
"John Smith"
- Number - A numeric value. Examples:
42
,
98.6
- Enum - A value from a predefined list. Examples:
"Yes"
,
"No"
,
"Maybe"
- Boolean - True or false Dynamic variables use double curly braces syntax like
{{variable_name}}
[(3) ]() . They can be used in various parts of the agent including prompts, begin messages, tool call URLs, and tool call descriptions . One important edge case to be aware of: when a dynamic variable is not assigned a value, it will remain unchanged in the output . For example, if
user_name
is not set, the output will show
"Hello {{user_name}}, how can I help you today?"
rather than being replaced with an empty string . To check if a dynamic variable is not set, you can use the equation
{{variable_name}} contains {{
in conversation flow, which would evaluate to true if it's not set . Could you provide more specific details about what type of variable you're trying to set and what error message you're encountering? This would help identify the specific issue you're facing.
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variable Node](https://docs.retellai.com/build/conversation-flow/extract-dv-node) [[2] Node Overview](https://docs.retellai.com/build/conversation-flow/node) [[3] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy This is what I amtrying to do: if {{agent_number}} is +12123456789, remember that the operatorNumber is 1564 else if {{agent_number}} is +1111111111 set memory.operatorID to 0
a
Thanks for the follow-up, @teddyf0595_18280. I'll get back to you soon.
### Answer Based on the available sources, I can see you're trying to implement conditional logic to set variables based on the agent number. Here's what I can tell you about working with variables in Retell AI's conversation flow: For setting variables unconditionally, you can use an Extract Variable node where you directly assign a value [(1) ]() . To set a variable to a specific value unconditionally, you would specify the Variable Name (e.g.,
operatorNumber
) and directly assign the Value (e.g.,
1564
) . Dynamic variables in Retell AI use double curly braces syntax like
{{variable_name}}
[(2) ]() . These can be used in various parts of the agent including prompts, begin messages, tool call URLs, and tool call descriptions . However, the conditional logic you're describing (
if {{agent_number}} is +12123456789, then set operatorNumber to 1564
) appears to require more complex conditional branching than what's explicitly documented in the available sources. The sources don't provide specific examples of implementing conditional variable assignment based on comparing dynamic variable values. For your specific use case of setting different operator numbers based on the agent number, you might need to use conversation flow transitions with conditions, but the exact implementation details for this type of conditional variable setting aren't covered in the available documentation. I'd recommend checking out these potentially useful sources for more detailed conversation flow documentation, or you could ask for a general answer if you'd like me to suggest possible approaches based on general knowledge.
​ To learn more, see the sources I considered: [[1] Extract Variable always True Unconditionally](https://discord.com/channels/1186424376300679209/1390309243860680704) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.