Forum Discussion

Ismail_ZA's avatar
Ismail_ZA
Regular Visitor
11 months ago
Solved

Fabric Gen2 Dataflow Variable.Value not working when referencing the Variable Library. ErrorCode =

Greetings, 

 

I setup my Variable Library ...

Workspace folder location ..

 

 

I created  a Gen2 Dataflow (CI/CD) enabled to test ...

But I cannot reference the variable in my Dataflow!?!  

I've checked and rechecked everything that CoPilot said I should check ... and still nothing, maybe the I in AI was overstated, so I proceeded to removing underscores from the variable names moved Dataflow and Variable Library into the root of the Workspace, still nothing.

 

Please, anyone with advice on what I'm missing here?

 

  • Hello Ismail_ZA,

     

    What’s happening

    • In Dataflow Gen2 (CI/CD) the editor doesn’t actually resolve Variable Library values. If you call Variable.Value("$(/**/…)" ) in the editor, you’ll get “variable … could not be found (ErrorCode 10418)” even when the variable exists. Resolution happens at run time.

    Do this instead

    1. Use a fallback in authoring
      Replace your call with:

       
      Variable.ValueOrDefault("$(/**/Data Management/Environment/Workspace_Variables/v_WorkspaceID)", "DEV-LOCAL-FALLBACK")

      – This lets the query evaluate in the editor using the fallback; at refresh/run time the Variable Library value is injected and the fallback is ignored.

    2. Confirm the exact path & names

      • The syntax must be: $(/**/<Folder>/<LibraryName>/<VariableName>)

      • Names are exact (spaces/case matter). Avoid trailing spaces or hidden characters.

      • Try a simpler path (e.g., move the library to the workspace root) and rename to something plain like EnvVars ➜ v_WorkspaceID, then test:

         
        Variable.ValueOrDefault("$(/**/EnvVars/v_WorkspaceID)", "DEV-LOCAL-FALLBACK")
    3. Same workspace + CI/CD enabled

      • The Variable Library and the Dataflow Gen2 (CI/CD) must be in the same workspace.

      • Ensure the dataflow is CI/CD-enabled (that SKU/flag enables variable resolution at runtime).

    4. Run with an active value set

      • If you’re using value sets (DEV/UAT/PROD), make sure the intended set is active when you run (via pipeline or dataflow run settings).

    5. Supported types only

      • Variables must be one of: Boolean, DateTime, Guid, Integer, Number, String. (Strings are safest for IDs/paths.)

    6. Preview + rollout note

      • This feature shipped last week at FabCon and is still in Preview. It may not be fully rolled out in every region/capacity yet. If everything above looks right and it still fails at run time (not just in the editor), it could be a rollout gap—try again later or test in a different capacity/region if you have one.

    Quick checklist

    • Use ValueOrDefault(...) during authoring

    • Verify exact path $(/**/Library/Variable)

    • Library + Dataflow in the same workspace

    • Dataflow is CI/CD-enabled

    • Run with the correct value set

    • Variable type is supported

     

    Doc : https://learn.microsoft.com/fr-fr/fabric/data-factory/dataflow-gen2-variable-library-integration

     

    Hope it can help you ! 

    Best regards,

    Antoine

3 Replies

  • Hello Ismail_ZA,

     

    What’s happening

    • In Dataflow Gen2 (CI/CD) the editor doesn’t actually resolve Variable Library values. If you call Variable.Value("$(/**/…)" ) in the editor, you’ll get “variable … could not be found (ErrorCode 10418)” even when the variable exists. Resolution happens at run time.

    Do this instead

    1. Use a fallback in authoring
      Replace your call with:

       
      Variable.ValueOrDefault("$(/**/Data Management/Environment/Workspace_Variables/v_WorkspaceID)", "DEV-LOCAL-FALLBACK")

      – This lets the query evaluate in the editor using the fallback; at refresh/run time the Variable Library value is injected and the fallback is ignored.

    2. Confirm the exact path & names

      • The syntax must be: $(/**/<Folder>/<LibraryName>/<VariableName>)

      • Names are exact (spaces/case matter). Avoid trailing spaces or hidden characters.

      • Try a simpler path (e.g., move the library to the workspace root) and rename to something plain like EnvVars ➜ v_WorkspaceID, then test:

         
        Variable.ValueOrDefault("$(/**/EnvVars/v_WorkspaceID)", "DEV-LOCAL-FALLBACK")
    3. Same workspace + CI/CD enabled

      • The Variable Library and the Dataflow Gen2 (CI/CD) must be in the same workspace.

      • Ensure the dataflow is CI/CD-enabled (that SKU/flag enables variable resolution at runtime).

    4. Run with an active value set

      • If you’re using value sets (DEV/UAT/PROD), make sure the intended set is active when you run (via pipeline or dataflow run settings).

    5. Supported types only

      • Variables must be one of: Boolean, DateTime, Guid, Integer, Number, String. (Strings are safest for IDs/paths.)

    6. Preview + rollout note

      • This feature shipped last week at FabCon and is still in Preview. It may not be fully rolled out in every region/capacity yet. If everything above looks right and it still fails at run time (not just in the editor), it could be a rollout gap—try again later or test in a different capacity/region if you have one.

    Quick checklist

    • Use ValueOrDefault(...) during authoring

    • Verify exact path $(/**/Library/Variable)

    • Library + Dataflow in the same workspace

    • Dataflow is CI/CD-enabled

    • Run with the correct value set

    • Variable type is supported

     

    Doc : https://learn.microsoft.com/fr-fr/fabric/data-factory/dataflow-gen2-variable-library-integration

     

    Hope it can help you ! 

    Best regards,

    Antoine

    • Ismail_ZA's avatar
      Ismail_ZA
      Regular Visitor

      Thank you Antoine for the detailed explanation.  This solved the problem.

  • Mine also does not work, and I copied/pasted the format from the documentation. This is a new feature in preview, it is possible that it just hasn't released yet to all regions?

    formula used: Variable.Value("$(/**/VariableLibraryTest/test)")