Complex prompt : mixing like and in sql operators

Hello All BOB ! :wink:

In some reports we are currently developping, we face a crasy problem :

In prompts, our client want to make a IN selection using List of Values, and, after, the selection would be a “like” of each element selectionned.

For example, user selects in LOV values [titi, toto, tutu], to choose titi%, toto% and tutu%

How can this be done ?? :confused: :confused: :confused:

thanks for advance
Bernard


bernard timbal :fr: (BOB member since 2003-05-26)

In prompts, our client want to make a IN selection using List of Values,
and, after, the selection would be a “like” of each element selected.
For example, user selects in LOV values [titi, toto, tutu], to choose titi%,
toto% and tutu%

HYPOTHESIS:

The elements of the LOV have the same length.

If so, and if you have the following where condition:

TABLE_WORK.WORKER_NAME IN @Prompt(‘Who is?’, {‘titi’, ‘toto’, ‘tutu’})

… you can rewrite it as follows:

substr(TABLE_WORK.WORKER_NAME, 1, 4) IN @Prompt(‘Who is?’, {‘titi’, ‘toto’, ‘tutu’})

NOTE:

If the TABLE_WORK.WORKER_NAME is INDEXED, with substr you’ll lose any benefit of the index!!

If the elements of the LOV aren’t of the same length… let us know! :wink:


Donald Duck :mexico: (BOB member since 2004-07-29)

Value LIKE CONCAT(@prompt(‘Select from LOV’,‘A’,mono,constrained),’%’)

Above example is for Oracle. Your wish to combine LIKE and IN is, in my opinion, impossible. If not, I would not know how to!


jobjoris :netherlands: (BOB member since 2004-06-30)

The concatenation of the prompt with ‘%’ is a good idea! :wink:


Donald Duck :mexico: (BOB member since 2004-07-29)