Forum Discussion

patator35's avatar
patator35
Frequent Visitor
8 years ago
Solved

Using GetValue (NamedCell) and Logical Type error

Hello,

 

I'm trying to retrieve the value of a cell in my query but end up with an error message:

The part of my query getting the error is :
= Table.SelectRows(#"Type modifié2",each GetValue("SQL"))
The (GetValue("SQL")) correctly returns "34" (value of my cell) but a message says that 34 can not be converted to a logical value :
"Nous n'avons pas pu convertir la valeur 34 en type Logical.
Détails :
Value=34
Type=Type"

 

I have set all source permissions to public and have activated the Fast Combine option as read in some forums
What to do ?

 

Thanks

Patrice

  • It looks like alternative 2 would be the one you are looking for, HOWEVER:

     

    Regarding your question if #"Filtered Rows" can be avoided: you can retrieve your data directly from the SQL database, in which case all logic may be executed on the server, which is definitely the fasted solution.

     

    If you connect directly to the SQL database, the logic will be executed on the server in either of 3 cases:

     

    1. Query folding is in place.

    Your query must be set up in such a way that the internal engine can translate the entire code to a native query, which you can check by right clicking the last step in your query and choose "Native Query": if it is greyed out, then there is no query folding, otherwise you will see the SQL-statement that is used to retrieve the data from the server (which is a translation of you entire query definition).

    It can also be that query folding is in place up to a particular step in your query.

    A statement using "Expression.Evaluate" would definitely disrupt query folding.

     

    2. Direct Query mode.

    In this case, the data is retrieved from the server once required, i.e. when visuals are displayed.

     

    3. Provide a SQL Statement (under "Advanced options") when connecting to the SQL server database.

    See screenshot below.

     

    Otherwise this is basically all I know in this area; I have no experience with it, so in case of any further questions, I will probably not be able to provide an answer.
    In that case, my advice would be to start a new topic with your specific questions (well reflected in the topic subject), as a topic with 0 replies will get attention from other helpers.

     

     

7 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Your second parameter needs to evaluate to true/false, so something like:

     

    = Table.SelectRows(#"Type modifié2",each GetValue("SQL")=34)

    • patator35's avatar
      patator35
      Frequent Visitor
      Thanks but the contents of the names cell will vary . There will be other "or" statement in the sql.
      I can not use your solution =34
      The getvalue("sql) returns exactly " [area]="34" or [area]="36"...
      If I replace the getvalue("sql") by the exact same text than what is returned by the function(" [area]="34" or [area]="36"), it works great.


      • MarcelBeug's avatar
        MarcelBeug
        Community Champion

        It is all rather confusing: according to the error message, GetValue("SQL") just returns a number (34), not "[area] = 34".

         

        Anyhow, I guess you need:

         

        = Table.SelectRows(#"Type modifié2",each [area] = GetValue("SQL"))