Hellsteeth
Systems Engineer
Hello, I am usually pretty good with Crystal Reports but this one has got me stumped so reaching out for any guidance. I am using Crystal Reports 2011.
I have data that is in one of the following three formats held in a string field.
1. ABC-1 @ 123E
2. ABC-1 @ 123W
3. Other data not containing the @ symbol for example “Future Planning”
The characters represented by ABC will always be standard letters of the alphabet A to Z in capitals and three characters long.
The numbers 123 will always be numbers 0 to 9 but may contain a decimal place. Examples would be “5.0”, “7.23”, “35”, "105".
The hyphen, blank spaces and @ are always consistent with respect to formatting as shown in options 1 and 2 above.
The last letter in option 1 and 2 can only ever be an E or W representing angles East or West.
What I would like to do is extract just the number as follows;
In the event the last letter is E, then just extract the numbers 123.
In the event the last letter is W, then extract the number but convert it to an Easterly angle 237 (360-123 = 237).
In the event the data is not in this format, consistently output the number 0.
Some examples;
Data = “DEF-5 @ 26.8E” then output 26.8 as a number.
Data = “FGH-9 @ 105W” then output 255 as a number. (The result of subtracting 105 from 360)
Data = “Some other text” then output 0 as a number
Hopefully this is a clear explanation but will respond to any questions for further clarifications.
Thank you for looking.
I have data that is in one of the following three formats held in a string field.
1. ABC-1 @ 123E
2. ABC-1 @ 123W
3. Other data not containing the @ symbol for example “Future Planning”
The characters represented by ABC will always be standard letters of the alphabet A to Z in capitals and three characters long.
The numbers 123 will always be numbers 0 to 9 but may contain a decimal place. Examples would be “5.0”, “7.23”, “35”, "105".
The hyphen, blank spaces and @ are always consistent with respect to formatting as shown in options 1 and 2 above.
The last letter in option 1 and 2 can only ever be an E or W representing angles East or West.
What I would like to do is extract just the number as follows;
In the event the last letter is E, then just extract the numbers 123.
In the event the last letter is W, then extract the number but convert it to an Easterly angle 237 (360-123 = 237).
In the event the data is not in this format, consistently output the number 0.
Some examples;
Data = “DEF-5 @ 26.8E” then output 26.8 as a number.
Data = “FGH-9 @ 105W” then output 255 as a number. (The result of subtracting 105 from 360)
Data = “Some other text” then output 0 as a number
Hopefully this is a clear explanation but will respond to any questions for further clarifications.
Thank you for looking.