Dec 16, 2002 #1 strom99 MIS Nov 28, 2000 126 US I have the following field 55 gal container (750 lb, 341 kg) Holder (11 lb, 5kg) I need to be able to extract the 750 lb, 341 kg in order to sort on this field. Crystal 8.5 Thanks!
I have the following field 55 gal container (750 lb, 341 kg) Holder (11 lb, 5kg) I need to be able to extract the 750 lb, 341 kg in order to sort on this field. Crystal 8.5 Thanks!
Dec 16, 2002 #2 rosemaryl MIS Jul 13, 1999 1,367 US Dear Strom99, If this is always the format you show above, then this formula should work: Mid({Table.WeightField},instr({Table.WeightField},"(",length({Table.WeightField})) This will return (750 lb, 341 kg) If you need to remove both parens adjust to this: Mid({Table.WeightField},instr({Table.WeightField},"("+1,length(Mid({Table.WeightField},instr({Table.WeightField},"("+2)))) Hope that helps, ro Rosemary Lieberman rosemary@microflo.com, http://www.microflo.comMicroflo provides expert consulting on MagicTSD and Crystal Reports. Upvote 0 Downvote
Dear Strom99, If this is always the format you show above, then this formula should work: Mid({Table.WeightField},instr({Table.WeightField},"(",length({Table.WeightField})) This will return (750 lb, 341 kg) If you need to remove both parens adjust to this: Mid({Table.WeightField},instr({Table.WeightField},"("+1,length(Mid({Table.WeightField},instr({Table.WeightField},"("+2)))) Hope that helps, ro Rosemary Lieberman rosemary@microflo.com, http://www.microflo.comMicroflo provides expert consulting on MagicTSD and Crystal Reports.
Dec 16, 2002 #3 synapsevampire Programmer Mar 23, 2002 20,180 US Since these are the same, with two different measurement systems, and since you want to sort (meaning you want numeric values): if isnumeric(mid("Stuff (750 lbs )",1+instr("Stuff (750 lbs )","(",1)) then val(mid("Stuff (750 lbs )",1+instr("Stuff (750 lbs )","(", instr("Stuff (750 lbs )","l"-(1+instr("Stuff (750 lbs )","("))) else 0 Replacing "Stuff (750 lbs )" with your field name. This also verifies that it's a number after the first ( character and returns 0 (so they would sort first). -k http://www.informeddatadecisions.comkai@informeddatadecisions.com Upvote 0 Downvote
Since these are the same, with two different measurement systems, and since you want to sort (meaning you want numeric values): if isnumeric(mid("Stuff (750 lbs )",1+instr("Stuff (750 lbs )","(",1)) then val(mid("Stuff (750 lbs )",1+instr("Stuff (750 lbs )","(", instr("Stuff (750 lbs )","l"-(1+instr("Stuff (750 lbs )","("))) else 0 Replacing "Stuff (750 lbs )" with your field name. This also verifies that it's a number after the first ( character and returns 0 (so they would sort first). -k http://www.informeddatadecisions.comkai@informeddatadecisions.com
Dec 16, 2002 #4 synapsevampire Programmer Mar 23, 2002 20,180 US Perhaps I should clarify why you need a numeric: Given the values: (1 lb...) (2 lb...) (10 lb...) (100 lb...) (200 lb...) (9 lb...) If it's a string, then you'd get the following sort: (1 lb...) (10 lb...) (100 lb...) (2 lb...) (200 lb...) (9 lb...) If it's a value, you'd get: (1 lb...) (2 lb...) (9 lb...) (10 lb...) (100 lb...) (200 lb...) Remember, you don't have to show the field you sort on, it simply allows for proper sortation. -k http://www.informeddatadecisions.comkai@informeddatadecisions.com Upvote 0 Downvote
Perhaps I should clarify why you need a numeric: Given the values: (1 lb...) (2 lb...) (10 lb...) (100 lb...) (200 lb...) (9 lb...) If it's a string, then you'd get the following sort: (1 lb...) (10 lb...) (100 lb...) (2 lb...) (200 lb...) (9 lb...) If it's a value, you'd get: (1 lb...) (2 lb...) (9 lb...) (10 lb...) (100 lb...) (200 lb...) Remember, you don't have to show the field you sort on, it simply allows for proper sortation. -k http://www.informeddatadecisions.comkai@informeddatadecisions.com
Dec 16, 2002 #5 rosemaryl MIS Jul 13, 1999 1,367 US Dear SV, I hadn't thought that through for him as regards the sorting.... Your solution is much better! Thanks, ro Rosemary Lieberman rosemary@microflo.com, http://www.microflo.comMicroflo provides expert consulting on MagicTSD and Crystal Reports. Upvote 0 Downvote
Dear SV, I hadn't thought that through for him as regards the sorting.... Your solution is much better! Thanks, ro Rosemary Lieberman rosemary@microflo.com, http://www.microflo.comMicroflo provides expert consulting on MagicTSD and Crystal Reports.