Token Eof expected (row #1)

  • Token Eof expected (row #1)

    Posted by DSC Communities on December 1, 2019 at 12:37 pm
    • GĆ©rard Ducouret

      Member

      December 1, 2019 at 12:37 PM

      Hello,
      I’m trying to create my first Function. In fact I use the Applied steps list and the Advanced Editor.Ā 
      I just added 2Ā  rows at the beginning and 2 at the end.Ā 
      I always get an error : “Token Eof expected” with a red symbol on the first row
      What I did wrong ? šŸ™
      Thanks

      PLease see attached txt file

      ——————————
      GƩrard Ducouret
      ——————————

    • Audrey Abbey

      Member

      December 1, 2019 at 11:19 PM

      Hi Gerard,

      Try changing your capital letters in “Let” and “In: to lower case.
      Power Query is case sensitive and the commands should be all lower case.
      You may also need to add the data type to your parameter “NomFichier

      Here is an example of a function I have in one of my files, that calls a stored procedure with Start and End date parameters, so that you can see the syntax.
      I set up the StartDate and EndDate parameters before setting up the function.

      let
      SQLSource = (StartDate as date, EndDate as date) =>

      let
      Source = Sql.Database(“ServerName”, “DatabaseName”, [Query=”EXEC Database.dbo.StoredProcedureName ‘”&Date.ToText(StartDate)&”‘,'” & Date.ToText(EndDate)&”‘”, CreateNavigationProperties=false])
      in
      Source
      in
      SQLSource

      Hope that helps!

      ——————————
      Audrey Abbey
      SR. BI Developer/Analyst
      LeapFrogBI
      Portland OR
      ——————————
      ——————————————-

    • GĆ©rard Ducouret

      Member

      December 2, 2019 at 8:26 AM

      Great! That works!
      Thanks a lot Audrey

      ——————————
      GƩrard Ducouret
      ——————————
      ——————————————-

    • Farhan Ahmed

      Member

      December 2, 2019 at 12:19 AM

      Yes you need need to change “Let” and “In” to small case as mentioned,Ā  Power Query is case sensitive

      let
      Recup = (NomFichier) =>
      
      let
          Source = Excel.Workbook(File.Contents(NomFichier), null, true),
          Feuil1_Sheet = Source{[Item="Feuil1",Kind="Sheet"]}[Data],
          #"Promoted Headers" = Table.PromoteHeaders(Feuil1_Sheet, [PromoteAllScalars=true]),
          #"Removed Top Rows" = Table.Skip(#"Promoted Headers",38),
          #"Filled Down" = Table.FillDown(#"Removed Top Rows",{"Column1", "Column2", "Column3"}),
          #"Filtered Rows" = Table.SelectRows(#"Filled Down", each [DonnƩes en 7 classeurs Excel] <> null),
          #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each [DonnƩes en 7 classeurs Excel] <> "Total"),
          #"Promoted Headers1" = Table.PromoteHeaders(#"Filtered Rows1", [PromoteAllScalars=true]),
          #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers1",{{"Marque ", type text}, {"AnnƩe", type text}, {"Version", type text}, {"Pays", type text}, {"01", Int64.Type}, {"02", Int64.Type}, {"03", Int64.Type}, {"04", Int64.Type}, {"05", Int64.Type}, {"06", Int64.Type}, {"07", Int64.Type}, {"08", Int64.Type}, {"09", Int64.Type}, {"10", Int64.Type}, {"11", Int64.Type}, {"12", Int64.Type}}),
          #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Marque ", "AnnƩe", "Version", "Pays"}, "Attribute", "Value"),
          #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "Date", each "01"&"/"&[Attribute]&"/"&[AnnƩe]),
          #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Date", type date}}),
          #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"AnnƩe", "Attribute"}),
          #"Filtered Rows2" = Table.SelectRows(#"Removed Columns", each [Value] <> 0)
      in
          #"Filtered Rows2"
      
      in
      Recup?

      ?

      ——————————
      Farhan Ahmed
      Senior Business Intelligence Consultant
      karachi
      3452523688
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 9 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Token Eof expected (row #1)’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!