Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apply Simple based Attribute (SQL Server)

Status
Not open for further replies.

10161977

Technical User
Jun 25, 2004
11
US
Hi,

I am trying to create an Attribute based on the following logic.

If "Attribute 1" is NULL then "Attribute 2" else "Attribute 1".

I have tried using apply simple along with a case statement but I guess I am making a sytax error.

The database being used is SQL Server.

Any help is greatly appreciated.
 
do you mean

if column1 is null, then column2, else column1

if yes, then you don't need to use applysimple, instead use

Case("isnull(column1)", [column1], [column2])
 

nlim,

I tried this to create an attribute, but I am getting an error message when I validate the expression.

"Object (of Type: Function) not allowed in this place"

thanks
teccum.
 
there's a strange bug in the attribute form window. You need to use the f(x) button in the expression editor to create the expression.

find the case function under internal functions, for condition type in "isnull(column1)", then pick column1 for result1. Click finish.

now in the expression window, after column1, type a comma and add column2.

The validator should recognize it now.
 

nlim,

I am now able to create the attribute with the steps you have mentioned.

You are absolutely right that it gives a strange error message when I tried creating this condition by typing in the Expression window.

Earlier, I think, the mistake which I did while using the function is, I was trying to give else condition column(column 2) in the result and argument area and was validating it instead typing a comma and the column 2.

Thanks for the clear guidance.
teccum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top