combine calculation flds

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
Smzemke_(Guest)
Posts: 41
Joined: Tue Oct 10, 2017 12:44 pm

combine calculation flds

Post by Smzemke_(Guest) » Thu Jun 02, 2005 4:51 pm

If I have multiple calcuation fields that only contain strings of data, is it possible to combine them all into a new calculation field?____example:____Calculation fields:__ Field F1 contains "strawberries"__ Field F2 contains "blueberries"__ Field F3 contains "rasberries"____Is it possible for me to combine these into a field and call the field "Berries", and have each of the above fields in this new one?____Does that make sense?____I want to do it for using iif statements, i.e. IIf A=1,Berries=F1____Thanks

Alan_Klein
Posts: 68
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: combine calculation flds

Post by Alan_Klein » Thu Jun 02, 2005 6:14 pm

You are on the right track. For example:____Name the field "Berries", with the expression:__IIF(A=1, F1 + " " + F2, F2)____In this example, if A=1 then Berries will be "strawberries blueberries", otherwise it will just be "blueberries". You can put punctuation along with the space in the quotation marks in the middle, if needed.____You can nest IIF^s as well. For example:____IIF(A=1, F1, IIF(A=2, F1 + " " + F2, IIF(A=3, F1 + " " + F2 + " " + F3,"")))____In this example:__If A=1, Berries will be "strawberries";__If A=2, Berries will be "strawberries blueberries"__If A=3, Berries will be "strawberries blueberries rasberries"____In no case will raspberries be spelled correctly!

Alan_Klein
Posts: 68
Joined: Tue Oct 10, 2017 12:44 pm

==> RE: combine calculation flds

Post by Alan_Klein » Thu Jun 02, 2005 6:15 pm

That line with the smiley should read:____IIF(A=1, F1, IIF(A=2, F1 + " " + F2, IIF(A=3, F1 + " " + F2 + " " + F3,""))

Alan_Klein
Posts: 68
Joined: Tue Oct 10, 2017 12:44 pm

===> RE: combine calculation flds

Post by Alan_Klein » Thu Jun 02, 2005 6:17 pm

Once again, without feeling:____IIF(A=1, F1, IIF(A=2, F1 + " " + F2, IIF(A=3, F1 + " " + F2 + " " + F3,"" ) ) )

Smzemke_(Guest)
Posts: 41
Joined: Tue Oct 10, 2017 12:44 pm

====> RE: combine calculation flds

Post by Smzemke_(Guest) » Fri Jun 03, 2005 7:49 am

I^ll try this out - Thanks for your suggestion!

Rick_Johnson_(Guest)
Posts: 35
Joined: Tue Oct 10, 2017 12:44 pm

=====> RE: combine calculation flds

Post by Rick_Johnson_(Guest) » Fri Jun 03, 2005 9:50 am

Another way to do this, if there are not too many different berries, is to use the CASE statement. Much like the IFF, it might be a tad easier to write and more importantly, when you go back a year from now to modify, might be more readable. ____CASE(BerryCode,"1","strawberries","2","strawberries blueberries","3","strawberries blueberries rasberries", " ")______In this situation, if the BerryCode is not 1,2,3 you get the default " " (space).________________

Smzemke_(Guest)
Posts: 41
Joined: Tue Oct 10, 2017 12:44 pm

======> RE: combine calculation flds

Post by Smzemke_(Guest) » Thu Jun 09, 2005 9:27 am

Thank you - I^ll try that too!

Post Reply