4 Replies Latest reply on Mar 9, 2014 1:55 AM by PrestozNguyen

    Process results of ExecuteSQL

    PrestozNguyen

      Title

      Process results of ExecuteSQL

      Post

           For example, I have a query:

           Let ([

                    $query = "SELECT Description, Price, EUQ

                                      FROM PriceBook

                                      WHERE CatalogNumber LIKE ?"

                   ; $result = ExecuteSQL($query; ""; ""; fkCatalognumber)

           ];

                   .....

                  $result

           )

           So, how can I take out each value from the result of this query?

           Please help me! Thanks   

            

            

        • 1. Re: Process results of ExecuteSQL
          philmodjunk

               You need to specify field and record separators instead of using "" for each.

               Can you explain exactly what you mean by "take out each value"? I can think of several different things that you might mean by that. It may help to explain what you want to do with the results of this query.

          • 2. Re: Process results of ExecuteSQL
            PrestozNguyen

                 Hi PhilModJunk, 

                 I mean: How can I query many field just by one query? And after that, how can I take each value of results to calculate?

                 In details, with above query, I need 3 value: Description, List Price and EUQ. After that, how can I take Description to assign to a variable, List Price to assign to another variable, ect...

                 Please help me PhilModJunk!

            • 3. Re: Process results of ExecuteSQL
              philmodjunk

                   If a calculation field named cQuery is defined as:

                   Let ([

                            $query = "SELECT Description, Price, EUQ

                                              FROM PriceBook

                                              WHERE CatalogNumber LIKE ?"

                           ; $result = ExecuteSQL($query; ¶ ; ""; fkCatalognumber)

                   ];

                           .....

                          $result

                   )

                   Then Set Variable [$Description ; value: GetValue ( cQuery ; 1 ) ]

                   will assign the value of Description from your query to the variable named $Description.

              • 4. Re: Process results of ExecuteSQL
                PrestozNguyen

                     It works!

                     You're great PhilModJunk!

                     Thank you very much