cancel
Showing results for 
Search instead for 
Did you mean: 

Using an existing object with where clause inside the other object

Former Member
0 Kudos

Hi,

I have an object which is based on a prompt value.

I need a second object which takes the results of 1st object including the where condition and does some calculation

ex:

1) LOV object = country_id values

2) object1

select country.name from country

where country.name=@prompt('select country id','n','LOV Object'....)

3) Object2: If object1='India' then 'x' else 'y' end

My expected results will be something like

select case when a.name='India' then 'x' else 'y' end

from

(select country.name from country where country.country_id=1)a

Logic execution:

LOV should come from "LOV Object" and selected values should be passed to "Object 1" and based on these values we should get either 'x' or 'y'

But if i mention @select(object1) it is taking only the select of part of this object definition but not the where condition

Accepted Solutions (1)

Accepted Solutions (1)

MariannevL
Advisor
Advisor
0 Kudos

Hi,

You have to remember that you are writing SQL building blocks, not code...

Also when you use @select(), yes that will only pull the contents of the Select box of that object.

To get the contents of the Where box, you need @Where().

These are separate because typically you are either building a select part (normal objects) OR a where part (filters).

So think out of the box and decide how you would write it in a sql statement if you did not have a universe,

then break it in pieces that make sense.

I'm not 100% sure of what it is you are trying to achieve, but you can do something like:

case @where(object2) when TRUE then @select(object2) end

Off course writing this in one go is just as valid, you don't have to reuse, only with big chunks or @prompt() stuff it makes sense to prevent typo's

Hope this helps,

Marianne

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In object1

select country.name from country

where country.name=@prompt('select country id','n','LOV Object'....)

you have to give the object name in where clause as object

[LOV Object]

not like string.

Just try this.

Regards,

Ragoth.C

Former Member
0 Kudos

Hi,

What I meant by LOV Object is 'classname\objectname' not a string.