11 Replies Latest reply: Apr 12, 2012 7:42 AM by Thomas Mumaw

# Checking Length of Field

I am trying to set an indicator based on values in a field.  I have tried all of the following with no luck.  Any ideas?

Thanks
Thom

If (IsNull(KVGR4),1,0) as Organic

If Len(KVGR4 > 0,1,0) as Organic

If (Len(Trim(KVGR4) > 0),1,0) as Organic

• ###### Checking Length of Field

Hi Thom,

I may be missing something but there is one closing parenthesis missing in your code:

If(Len(Trim(KVGR4)), 1, 0) AS ORGANIC // 0 is false, otherwise true

Are you using some script variables or NULLASNULL, NULLDISPLAY statements in your code?

Hope that helps.

Miguel

• ###### Checking Length of Field

Nope....

• ###### Checking Length of Field

What value are you getting from the len and isnull without the if?

• ###### Checking Length of Field

I have not tried it without the if.

• ###### Checking Length of Field

The syntax should look like this:

If(Len(KVGR4) > 0,1,0) as Organic

• ###### Re: Checking Length of Field

Here is the statement I am using:  If(Len([Customer Acquisition]) > 0,1,0) as Organic   Organic is always a 1.

• ###### Re: Checking Length of Field

Hi,

Can you explain about what you trying to achieve?

Celambarasan

• ###### Re: Checking Length of Field

I want to separate my customers between Organic and Accquired.

• ###### Checking Length of Field

Hi,

Based on what condition you going to separate customers as Organic and Accquired?

Celambarasan

• ###### Re: Checking Length of Field

Thanks everyone for your responses, but finally got it to work using this: IsNum([Customer Acquisition]) as Organic.  It made the field either 0 or -1.

• ###### Checking Length of Field

Do you always get 0 when you use this statement?

If (IsNull([Customer Acquisition]),1,0) as Organic

If so, this would imply there is data in each cell.  In that case, the following should work.

If (Len(Trim([Customer Acquisition]) > 0),1,0) as Organic.

You could try running some SQL statements directly to see if the results mimic what you're seeing in QV.