cancel
Showing results for 
Search instead for 
Did you mean: 

Select Problem

Former Member
0 Kudos

Hello,

I have the following problem:

i want to change the select where command dynamically.

Sample:

Select *

From Table

Into wa

Where model->wherestring

model->wherestring = 'col1 = xyz AND col2 = xyz'

is it possible?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Quite easy actually.


data: tmp type string,
      tmp1 type string.

CONCATENATE '''' 'xyz' '''' INTO tmp.
CONCATENATE '''' 'xyz' '''' INTO tmp1.

CONCATENATE
  'col1'
  '='
  tmp
  'AND'
  'col2'
  '='
  tmp1
INTO tmp SEPARATED BY SPACE.

Select *
From Table
Into wa
Where (tmp)

You can of course do the string stuff differently but that's how you do it.


select * from TableInto wa
Where (model->wherestring)

That might work using the directly not sure but be sure you format your where string correctly with the quotes and all.

maximilian_schaufler
Active Contributor
0 Kudos

I kinda knew why I did refresh the topic before answering, sure Craig was faster

As for the quoting stuff - I use these quotes for strings most of the time:

``

They are less likely to occur within the string content, so you can use " and ' without any troubles.

Former Member
0 Kudos

I knew you were online Max looks like we both got the blue star though

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks...