Skip to Content
0
Former Member
Aug 25, 2011 at 07:18 AM

Dynamic WHERE clause in SELECT statement

30 Views

Hi,

I need to extract (SELECT) all the products in different salesorganizations. Since a product can be available in more than 1 salesorg I have created several properties in the PRODUCT dimension - 1 for each salesorganization (naming: Sxxxx where xxxx is the salesorganization number).

Since I need to prefix the salesorganization property with an "S" I have created a property on the SALESORG dimension called SALESORG.

Therefore I need to create a dynamic WHERE clause in the SELECT statement. Currently my script is:

*SELECT(%SORG%, "[SALESORG]",SALESORG, [ID]=%SALESORG_SET%)
*SELECT(%PROD%, "[ID]",PRODUCT, [%SORG%]="X")

My first SELECT find the Sxxx (equal to the property I need in the PRODUCT dimension). My second SELECT uses the variable in the first SELCT statement to use the correct property for the WHERE clause.

Unfortunately the code is not validated - any suggestions?

/Lars