Koonce Posted January 12, 2007 Posted January 12, 2007 I have a case function that is not working properly. It only picks up the first case. Case field >0, field; field 2 >0, field &","&field2; and so on until I go to six levels it is a bunch if names. that I want to put together with commas, I will pick up the first line but not get any of the others. Thanks in advance Randy
Koonce Posted January 12, 2007 Author Posted January 12, 2007 Case (field >0, field; field 2 >0, field &","&field2; ) forgot to add the parenthesis
Raybaudi Posted January 12, 2007 Posted January 12, 2007 Case( not IsEmpty ( field ) ; Case( not IsEmpty ( field2 ) ; field &","& field2; field ); "" ) BTW: the same result can be obtained without a Case function: Substitute ( Trim ( field & " " & field2 ) ; " " ; "," ) and for six fields: Substitute ( Trim ( field & " " & field2 & " " & field3 & " " & field4 & " " & field5 & " " & field6 ) ; " " ; "," ) :)
Fitch Posted January 12, 2007 Posted January 12, 2007 Yet another approach is a series of Case statements: Case( not IsEmpty( field ) ; field & ", " ) & Case( not IsEmpty( field2 ) ; field2 & ", " ) & Case( not IsEmpty( field3 ) ; field3 & ", " ) & etc
Genx Posted January 12, 2007 Posted January 12, 2007 (edited) Hi Randy, Yeah, the reason it doesn't work is because a case statement stops evaluating after one of the tests evaluates to true. If you want it to work, list the tests backwards in order. Edited January 15, 2007 by Guest
comment Posted January 12, 2007 Posted January 12, 2007 Substitute ( Trim ( field & " " & field2 & " " & field3 & " " & field4 & " " & field5 & " " & field6 ) ; " " ; "," ) I think you meant: Substitute ( [color:red]TrimAll ( field & " " & field2 & " " & field3 & " " & field4 & " " & field5 & " " & field6 ; 0 ; 0 ) ; " " ; "," )
Raybaudi Posted January 12, 2007 Posted January 12, 2007 (edited) if those fields contain spaces, try this one: Substitute ( [color:orange]TrimAll ( Substitute ( field & "|" & field2 & "|" & field3 & "|" & field4 & "|" & field5 & "|" & field6 ; [" " ; "^"] ; ["|" ; " "] ) ; 0 ; 0) ; [" "; ", "] ; [ "^" ; " "] ) Edited January 12, 2007 by Guest TrimAll as comment said !
Raybaudi Posted January 12, 2007 Posted January 12, 2007 I think you meant: Substitute ( [color:red]TrimAll ... Why ?
comment Posted January 12, 2007 Posted January 12, 2007 Because Substitute ( Trim ( field1 & " " & field2 & " " & field3) ; " " ; "," ) returns "field1,,field3" when field2 is empty.
Raybaudi Posted January 12, 2007 Posted January 12, 2007 oops... you are right ! So I corrected my second calc.
Koonce Posted January 13, 2007 Author Posted January 13, 2007 When I put this calc in the space between every word it puts a comma, I just want it between the full names. Substitute(TrimAll ( Child 1 Calc & " " & Child 2 Calc & " " & Child 3 Calc & " " & Child 4 Calc & " " & Child 5 Calc & " " & Child 6 Calc; 0; 0);" "; ", ") Result is Randy,Koonce,chase,pinkerton, and so on. Thank you for the answers.
Genx Posted January 13, 2007 Posted January 13, 2007 Try this one posted by daniele just above: Substitute ( TrimAll ( Substitute ( field & "|" & field2 & "|" & field3 & "|" & field4 & "|" & field5 & "|" & field6 ; [" " ; "^"] ; ["|" ; " "] ) ; 0 ; 0) ; [" "; ", "] ; [ "^" ; " "] )
Lee Smith Posted January 13, 2007 Posted January 13, 2007 If you use your real field names (i.e. LastName, FirstName instead Field 1, Field 2), it will not only help us to understand what you are wanting to accomplish, most of the times the Replies will use them too, thus, making it easier for you to read and understand the answers. A great thing about using Forum is that you can attach files, and this often really speed up the process of getting a resolution of your problem. Lee
Fitch Posted January 15, 2007 Posted January 15, 2007 Just a clarification: when Genx said "the reason it doesn't work is because a case statement stops evaluating after one of the tests evaluates to true" he was referring to the original poster's calc. Some people might get confused because his response followed my calc, which does work, although it's not quite as interesting as Daniele's.
Lee Smith Posted January 15, 2007 Posted January 15, 2007 Hi Tom, You have made a good point here. We all need to be more careful when replying to posts. In fact, I never use the Quick Reply (bottom of the page in the Tread), but instead use the Reply Button in the post I'm responding to. This ensures that the reponse will line up with the proper posts. Otherwise, the responder needs to acknowlege the person's post by putting the name of the poster in the first line (i.e. Hi Lee) [color:blue]BTW Tom, I don't believe I have ever seen a post of yours that wasn't spot on. Lee
Fitch Posted January 15, 2007 Posted January 15, 2007 Thanks for those kind words, Lee. I'm one of those who does use the Quick Reply, however. The main reason is that when I use the Reply button, I can't see the thread anymore. Therefore I don't pay that much attention to who is responding to who in the message header in general. As you say though, it is nice to have that extra bit of info ("Hi Lee"). Now back to your regularly scheduled topic.
Genx Posted January 15, 2007 Posted January 15, 2007 Hi Lee and Tom : Hehe, yeh I have a habit of doing that, but the main reason lately i haven't been hitting the reply button is because the page takes like 15 seconds to finish loading... I mean it loads, then it reloads, and then it reloads again, it's quite frustrating.. I wouldn't mind a "quick reply" button at the end of each post so you could click it, it could set the variable as to whoever your replying to and then just send you to the quick reply box.
Lee Smith Posted January 15, 2007 Posted January 15, 2007 I can't see the thread anymore Yeah, I agree. I usually have to us the [color:orange]Click to Review other posts in this topic, and It would also be nice to have the person we are replying to show in the header like the Subject does too. The drawback using this options is that the Version and Platform Info isn't there. like 15 seconds to finish loading This had been happening to me also. I'm hoping that it will start getting faster once the Software change over is complete. I have removed a few double posts by the same person which I would contribute to "Add Post" multiple times because of the lag. Thanks for your guys input. Lee
Koonce Posted January 16, 2007 Author Posted January 16, 2007 Ok here is the actual field names on the calc. Substitute ( Trim ( Child 1 Calc & " " & Child 2 Calc & " " & Child 3 Calc & " " & Child 4 Calc & " " & Child 5 Calc & " " & Child 6 Calc ) ; " " ; ", " ) This Calculation puts a comma between each word in the child 1 calc is the result of a persons fist name and last name. so it should be Randy Koonce but what I see is Randy, Koonce, and so on. thank you for the help.
Genx Posted January 16, 2007 Posted January 16, 2007 As i said before... Try this one posted by daniele just above: i.e. Substitute ( TrimAll ( Substitute ( Child 1 Calc & "|" & Child 2 Calc & "|" & Child 3 Calc & "|" & Child 4 Calc & "|" & Child 5 Calc & "|" & Child 6 Calc ; [" " ; "^"] ; ["|" ; " "] ) ; 0 ; 0) ; [" "; ", "] ; [ "^" ; " "] )
Recommended Posts
This topic is 6583 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now