Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago

M scripting conventions (suggestions)

Dear all,

 

I was wondering if anyone had any thoughts about M scripting conventions that works for them. I am just trying to work out a systematic way forward for myself.

 

I am thinking.

 

variables (ie. lists and scalar values) = camelCase (with lowercase first letter)

User defined functions = CamelCase (with uppercase first letter)

Names of Tables and other objects imported from databases = same name as they appear in the database

Fields in tables = First word uppercase and all words lowercase afterward

Names of Queries involved in intermediate processing (do not appear in the report) = lowercase_with_underscore_separator

Names of Queries that appear in the report view = Every First Letter Of Words In Uppercase 

 

I should add

Constants = ALL_UPPERCASE_WITH_UNDERSCORE

 

3 Replies

  • v-sihou-msft's avatar
    v-sihou-msft
    Microsoft Employee

    Anonymous

     

    I still can't understand your requirement. Can you share your expected result with sample data?

     

    Regards,

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi no requirements,

       

      I was just wondering if people have any conventions that they use in how they label variables, names of tables, names of queries nad so forth

       

  • hugoberry's avatar
    hugoberry
    Responsive Resident

    Because it is hard to collaborate on the Power Query scripts, there is little need agree on code name conventions. In my experience I'm trying to adhere to the rules that you mention in your post, but I think that a more authoritative input from @MSFT would be more desirable. Something in the lines of what Fsharp has would be good: http://fsharp.org/specs/component-design-guidelines/