Forum Discussion
Fabric Gen2 Dataflow: Variable.ValueOrDefault Not Retrieving Active Value from Variable Library
- 10 months ago
Hi cviciano7707,
I hit this before. Your dataflow is resolving the variable, but it is running with the library’s Default value set. That is why you always see Filename_Default.xlsx.
Key points
On-demand runs in the workspace use the library’s Default value set.
Dataflow Gen2 picks an alternative value set only when you bind or override it at run time.
Variable.ValueOrDefault falls back to the second argument if the library or value set is not bound for that run.
What to do
A. Quick proofIn Variable Library, switch the Default value set to QA.
Run the dataflow on-demand.
You should now see the QA file name. Switch back after testing.
B. Proper runtime binding
Trigger the dataflow from a Pipeline.
In the Dataflow Gen2 activity, open Runtime settings, select Variable library, choose the value set, then run.
Email alerts or Teams actions are optional.
C. Deployment pipelines
Use deployment rules to map the target stage to the desired value set, so Dev uses Default, QA uses QA, Prod uses Prod.
D. Authoring hygiene
In the dataflow, add a test step:
= Variable.Value("$(/**/Test/TestVar)")Confirm the preview matches the chosen value set after a pipeline-triggered run.
Keep the library and the dataflow in the same workspace.
Avoid duplicate library names across workspaces. If duplicates exist, use a fully qualified path tied to the workspace ID.
Common pitfalls
Expecting on-demand runs to follow QA or Prod. They follow Default.
Forgetting to set the value set on the Pipeline activity.
Caching during authoring. Use Refresh preview after changing the value set.
Missing library permissions for the runtime identity.
Hi cviciano7707,
I hit this before. Your dataflow is resolving the variable, but it is running with the library’s Default value set. That is why you always see Filename_Default.xlsx.
Key points
On-demand runs in the workspace use the library’s Default value set.
Dataflow Gen2 picks an alternative value set only when you bind or override it at run time.
Variable.ValueOrDefault falls back to the second argument if the library or value set is not bound for that run.
What to do
A. Quick proof
In Variable Library, switch the Default value set to QA.
Run the dataflow on-demand.
You should now see the QA file name. Switch back after testing.
B. Proper runtime binding
Trigger the dataflow from a Pipeline.
In the Dataflow Gen2 activity, open Runtime settings, select Variable library, choose the value set, then run.
Email alerts or Teams actions are optional.
C. Deployment pipelines
Use deployment rules to map the target stage to the desired value set, so Dev uses Default, QA uses QA, Prod uses Prod.
D. Authoring hygiene
In the dataflow, add a test step:
= Variable.Value("$(/**/Test/TestVar)")Confirm the preview matches the chosen value set after a pipeline-triggered run.
Keep the library and the dataflow in the same workspace.
Avoid duplicate library names across workspaces. If duplicates exist, use a fully qualified path tied to the workspace ID.
Common pitfalls
Expecting on-demand runs to follow QA or Prod. They follow Default.
Forgetting to set the value set on the Pipeline activity.
Caching during authoring. Use Refresh preview after changing the value set.
Missing library permissions for the runtime identity.
- cviciano770710 months agoRegular Visitor
Hi MJParikh ,
Thanks for replying.
I followed the three steps you described under Quick proof, and it worked — everything is functioning properly now.
I really appreciate your help.