SQL SIMILAR TO, REGEXP IN DATASET PARAMETER ALTERNATIVES

Hi,

I am trying to find a workaround to the following scenario. I believe that this is a QS limitation at least by now. Could you help me to find a solution?:

Example:

I am working with dataset parameters and Direct Query, and my intention is to find invoices that follows a pattern:
Invoice: 1234
I want to find Invoice 1234 or similar invoices(ab1234, 1234aa, etc)

Trying this out of a QS dataset I could easily implement something like:

WHERE invoice_number ~ ‘(1234)’
WHERE invoice_number SIMILAR TO ‘%(1234)%’

However, this approach is not available when I use a Custom SQL query(QS dataset).

This is the closest approach that I have, however I am missing a considerable amount of invoices because I only get those that match 100%.

SELECT * FROM test.test_table
WHERE invoice_number IN (<<$invoicenumber>>))

Any help on how I can achieve this at QS dataset level?

I really appreciate your help.

Thank you!

Hi @jgrueso,
The syntax of SQL is reacting to your database as opposed to Quick Sight. What database are your querying from?

Thank you

1 Like

Hi,

The examples below(excluding Quicksight) are querying a Redshift cluster, not problem at all. However, same queries do not work on Quicksight. I am guessing, that maybe QS does not support regular expression yet?

Thank you!

Hi @jgrueso,
Yes, you are correct, Quick Sight does not currently support regular expression.

Maybe you could try the contains function?

1 Like

Hi @jgrueso,
It’s been awhile since we last heard from you. Do you have any additional questions regarding your initial topic or were you able to find a work around?

If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.

Thank you!

Hi @jgrueso,
Since we haven’t heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new topic in the community and link this discussion for any relevant information that may be needed.

Thank you!