Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Global Variable

 I am developing a custom connector ,  There are various methods which needs to have a same variable as parameter . Is there an way to declare a  variable global  , whose value keeps on changing after every method and hold their new value ?

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    In my opinion, I'd like to suggest you define this 'global variable' as a query parameter. It can be invoked in your query table/steps and you can manually modify it on power query side.

    Using Query Parameters in Power BI Desktop 

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous  thanks , but I want to use it in my Custom Connector , not for report .  Is  there any way like this in custom connector? or power query?

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI Anonymous,

        It is possible to setting an optional parameter with default value in your connector, but you cant write back and change the default value which is defined in the custom connector. (New connector only existed the default value, changed new value not able sync to connections used the same connector)
        For query parameters, you only need to invoke it in connections. These invoked parameter values will update if you modify the current value of query parameter.

        For example:

        Query parameter:

        QP1=1, QP value will sync to all connectors who invoked it.

        Your query tables:

        Source1=CustomConnecotor(connectionstring1, QP1)

        Source2=CustomConnecotor(connectionstring2, QP1)

        Regards,

        Xiaoxin Sheng

  • Anonymous's avatar
    Anonymous
    Not applicable

    The idea of a global variable is not tied to table variables only, although scalar variables can be implemented through measures today. The fundamental difference with a calculated table, obviously, is that a global variable is evaluated at reporting time in a context-dependent way.

  • kdevroede's avatar
    kdevroede
    Frequent Visitor

    Hello,

     

    Did you find a solution to this problem?

    I have a similar problem where I need to store some state or global variable between the GetType and GetRows of Table.View.

     

    Tx 

    Koen