<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create a mutable global variable in M language in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Create-a-mutable-global-variable-in-M-language/m-p/3011773#M6528</link>
    <description>&lt;P&gt;Hi, community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a custom connector that needs to authenticate before data representation is done, and to do this I don't want to hardcode the auth credentials in my source code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I declared a global list&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;variable named&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;config = {"a"};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and in the &lt;U&gt;shared MyCustomConnector.Contents&lt;/U&gt; function, I'm doing a List.ReplaceValue on item &lt;EM&gt;"a"&lt;/EM&gt; in the list above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;shared MyCustomConnector.Contents = (BaseUrl as text, ClientId as text) =&amp;gt; 
List.ReplaceValue(config, "a", BaseUrl, Replacer.ReplaceText);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so in my &lt;EM&gt;StartLogin&lt;/EM&gt; function, I can just call the config by index like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//Start Login
StartLogin = (resourceUrl, state, display) =&amp;gt;
    let

        AuthorizeUrl ="https://"&amp;amp;Text.From(config{0})&amp;amp;"/oauth/authorize?" &amp;amp; Uri.BuildQueryString(
            [
                client_id = "11",
                response_type="code",
                state = state,
                redirect_uri = redirect_uri
            ]
        )
    in
        [
            LoginUri = AuthorizeUrl,
            CallbackUri = redirect_uri,
            WindowHeight = windowHeight,
            WindowWidth = windowWidth,
            Context = null
        ];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it appears that, the List.ReplaceValue is not being executed because whenever I try to &lt;STRONG&gt;set credential&lt;/STRONG&gt; for authentication, &lt;EM&gt;"a"&lt;/EM&gt; is being passed into the URL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be much appreciated&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jan 2023 11:51:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-01-11T11:51:13Z</dc:date>
    <item>
      <title>Create a mutable global variable in M language</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Create-a-mutable-global-variable-in-M-language/m-p/3011773#M6528</link>
      <description>&lt;P&gt;Hi, community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a custom connector that needs to authenticate before data representation is done, and to do this I don't want to hardcode the auth credentials in my source code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I declared a global list&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;variable named&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;config = {"a"};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and in the &lt;U&gt;shared MyCustomConnector.Contents&lt;/U&gt; function, I'm doing a List.ReplaceValue on item &lt;EM&gt;"a"&lt;/EM&gt; in the list above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;shared MyCustomConnector.Contents = (BaseUrl as text, ClientId as text) =&amp;gt; 
List.ReplaceValue(config, "a", BaseUrl, Replacer.ReplaceText);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so in my &lt;EM&gt;StartLogin&lt;/EM&gt; function, I can just call the config by index like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;//Start Login
StartLogin = (resourceUrl, state, display) =&amp;gt;
    let

        AuthorizeUrl ="https://"&amp;amp;Text.From(config{0})&amp;amp;"/oauth/authorize?" &amp;amp; Uri.BuildQueryString(
            [
                client_id = "11",
                response_type="code",
                state = state,
                redirect_uri = redirect_uri
            ]
        )
    in
        [
            LoginUri = AuthorizeUrl,
            CallbackUri = redirect_uri,
            WindowHeight = windowHeight,
            WindowWidth = windowWidth,
            Context = null
        ];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it appears that, the List.ReplaceValue is not being executed because whenever I try to &lt;STRONG&gt;set credential&lt;/STRONG&gt; for authentication, &lt;EM&gt;"a"&lt;/EM&gt; is being passed into the URL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be much appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 11:51:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Create-a-mutable-global-variable-in-M-language/m-p/3011773#M6528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-11T11:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create a mutable global variable in M language</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Create-a-mutable-global-variable-in-M-language/m-p/3015337#M6543</link>
      <description>&lt;P&gt;Please read Ben Gribaudo's primer again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a look at the meta data section too.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 01:48:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Create-a-mutable-global-variable-in-M-language/m-p/3015337#M6543</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-01-12T01:48:33Z</dc:date>
    </item>
  </channel>
</rss>

