Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

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

1 Solution

Accepted Solutions
tmumaw
Specialist II
Specialist II
Author

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.

View solution in original post

11 Replies
Miguel_Angel_Baeyens

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

Not applicable

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

tmumaw
Specialist II
Specialist II
Author

I have not tried it without the if.

tmumaw
Specialist II
Specialist II
Author

Nope....

Michael_Reese
Employee
Employee

The syntax should look like this:

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

tmumaw
Specialist II
Specialist II
Author

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

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Can you explain about what you trying to achieve?

Celambarasan

tmumaw
Specialist II
Specialist II
Author

I want to separate my customers between Organic and Accquired. 

Michael_Reese
Employee
Employee

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.