dbTalk Databases Forums  

If function applied to text field in calculation - Stupid question

comp.databases.filemaker comp.databases.filemaker


Discuss If function applied to text field in calculation - Stupid question in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
D.
 
Posts: n/a

Default If function applied to text field in calculation - Stupid question - 11-07-2005 , 09:04 PM






I have four text fields. For each one of them that equals an assigned
value, I want to return a 1 that is added together to get a sum.

For example:
textfield1 textfield2 textfield3 textfield4 calculation
black white black black

By having the calculation field as below I want it to return a value of
3:
If(textfield1 = "black", 1, 0) + If(textfield2 = "black", 1, 0) +
If(textfield3 = "black", 1, 0) + If(textfield4 = "black", 1, 0)

For some reason this function only returns "0". It makes no difference
if I say the calculation result is text or a number.

I tried simplifying the calcuation to: If(textfield1 = "black", 1, 0)
Still I only get 0 returned, or nothing if textfield1 is blank.

What am I doing wrong?

Thanks,
Dan


Reply With Quote
  #2  
Old   
D.
 
Posts: n/a

Default Re: If function applied to text field in calculation - Stupid question - 11-07-2005 , 09:05 PM






Using Filemaker pro 5.5 for windows.


Reply With Quote
  #3  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: If function applied to text field in calculation - Stupid question - 11-07-2005 , 09:18 PM



Are you sure your text fields are really text fields and not number
fields? That's my guess.

Another way of doing it -- won't help if the text fields are really
numbers, but it might be simpler if your desired calc is really as
simple as your example:

patterncount(textfield1 & textfield2 & textfield3 & textfield4, "black")




D. wrote:
Quote:
I have four text fields. For each one of them that equals an assigned
value, I want to return a 1 that is added together to get a sum.

For example:
textfield1 textfield2 textfield3 textfield4 calculation
black white black black

By having the calculation field as below I want it to return a value of
3:
If(textfield1 = "black", 1, 0) + If(textfield2 = "black", 1, 0) +
If(textfield3 = "black", 1, 0) + If(textfield4 = "black", 1, 0)

For some reason this function only returns "0". It makes no difference
if I say the calculation result is text or a number.

I tried simplifying the calcuation to: If(textfield1 = "black", 1, 0)
Still I only get 0 returned, or nothing if textfield1 is blank.

What am I doing wrong?

Thanks,
Dan

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #4  
Old   
D.
 
Posts: n/a

Default Re: If function applied to text field in calculation - Stupid question - 11-07-2005 , 09:27 PM



Disregard these posts. The problem is the field is based on a value
list. I will repost with a new question that is more specific to my
needs. Sorry about the mess if you have read this far.


Reply With Quote
  #5  
Old   
D.
 
Posts: n/a

Default Re: If function applied to text field in calculation - Stupid question - 11-07-2005 , 09:27 PM



Disregard these posts. The problem is the field is based on a value
list. I will repost with a new question that is more specific to my
needs. Sorry about the mess if you have read this far.


Reply With Quote
  #6  
Old   
D.
 
Posts: n/a

Default Re: If function applied to text field in calculation - Stupid question - 11-07-2005 , 09:27 PM



Disregard these posts. The problem is the field is based on a value
list. I will repost with a new question that is more specific to my
needs. Sorry about the mess if you have read this far.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.