Custom query not returning results when using parameters

Hi,

Here is my custom query where I populated the Select statement with the required values. You will see I get a query result returned.

However, when I use parameters, I get no query result.


Why would the query fail to return results when using parameters?

The database is MS SQL.

Thanks,
Ray

And what are the test values of the parameters you entered to be used to run the custom query?

Hi George ,

The values I passed in the first screen shot are listed in the parameter test value columns in the second screen shot.

They are the same values for both queries.

Thanks
Ray

@George Sorry, I was driving at the time.

:P1 = IbeccK._tk8*UbL:^GH/%P8uC
:P2 = Camera192Q3

Regards,
Ray

Are you sure those records exist in the development database you are using on this target?

@George, I’m not changing the target or leaving the custom query screen.

So if I am getting the record when directly providing the values, I would presume I would also get the record when using parameters.

Thanks,
Ray

Are you sure your password is coming through from $_POST not $_GET?

Hi @Heather_Mann

There is no need to use POST or GET when using test values and executing it from within the query window.

Thanks
Ray.

@George I have even tried to reduce from two parameters to one so that I can be sure that the + operation was not causing some strange result, but this has made no difference.

Replicating the original query in MS SQL using the two parameters will retrieve a record.

Thanks, Ray.

1 Like

Hi @George ,

Just wondering if you had a chance to look into this any further.

Thanks
Ray

Hi guys,

I am just wondering if there is anything else I can provide to help progress this.

Thanks,
Ray

Potential workaround: have you tried performing the concatenation inside a set-value action step just prior to the custom query step, then just having one param to the query referencing the set-value step? This will rule out the concatenator somehow formatting poorly.

For troubleshooting, I would try a value that does not include special characters. I ran into that problem once, and Wappler was able to fix once identified.

I have a similar problem since I upgraded Wappler to 5.4.0 and fixed it by adding output type to query:

“outputType”: “array”

Locate your custom query file and inspect the code, you should see something like this

{
    "name": "custom",
    "module": "dbupdater",
    "action": "custom",
    "options": {
      "connection": "db",
      "sql": {
        "query": "SELECT LEFT(UUID(), 6) AS token",
        "params": []
      }
    },
    "output": false,
    "meta": [
      {
        "name": "secret",
        "type": "text"
      }
    ],
    "outputType": "array" ( code added )
  },

I checked the projects not yet updated to version 5.4.0 and I noticed that the files generated with previous versions included in the query the output type “outputType”: “array”, while now it is omitted.
Maybe a very small bug.

I hope it can help you

Hi, thanks fo the response. Yes had already tried as you suggested with the same result.

Thanks,
Ray