Jump to content

This topic is 8018 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Once again I need your help with a simple thingy. It's 8:50 p.m. and I still haven't solved this simple calculation. I know some of you have this done in 2 minutes so could you plz help me out, while I finally roll into bed.

I would like to have a calculationfield that presents the numbers 375 from the field Street, which contains: John S. Christianstreet 375-22

Easy huh, It would be nice it that calculation also would work when the field Street contains: Dr Docmanstreet 19 - 3 or 19 -3

Many thanks,

Rakesh

Posted

There was basically the same question few weeks ago.

Here's the suggestion I gave.

TextToNum(Case(Length(TextToNum(text)),LeftWords(Right(

text,

Length(text)-Min(

Case(Position(text, "1", 1, 1),Position(text, "1", 1, 1),64000),

Case(Position(text, "2", 1, 1),Position(text, "2", 1, 1),64000),

Case(Position(text, "3", 1, 1),Position(text, "3", 1, 1),64000),

Case(Position(text, "4", 1, 1),Position(text, "4", 1, 1),64000),

Case(Position(text, "5", 1, 1),Position(text, "5", 1, 1),64000),

Case(Position(text, "6", 1, 1),Position(text, "6", 1, 1),64000),

Case(Position(text, "7", 1, 1),Position(text, "7", 1, 1),64000),

Case(Position(text, "8", 1, 1),Position(text, "8", 1, 1),64000),

Case(Position(text, "9", 1, 1),Position(text, "9", 1, 1),64000)

)+1

), 1)))

Dj

Posted

Hi DJ,

Nice calculation and I think I follow most of what it is doing, except I don't know what the 64000 at the end of each line is doing?

TIA

Lee

confused.gif

Posted

Well, that was my guess too. But I wanted to verify it.

Thanks for you replay.

Lee

Posted

Yes 64000 stands for max num of chars in text field.

It is the shortcut to use with "Right" text functions, without checking how many characters (or words) are really available.

Dj smirk.gif

BTW for decimal numbers (with or without the leading zero) the calc will be slightly more complex

TextToNum(Case(Length(TextToNum(text)),LeftWords(Right(

text,

Length(text)-Min(

Case(Position(text, "1", 1, 1),Position(text, "1", 1, 1),64000),

Case(Position(text, "2", 1, 1),Position(text, "2", 1, 1),64000),

Case(Position(text, "3", 1, 1),Position(text, "3", 1, 1),64000),

Case(Position(text, "4", 1, 1),Position(text, "4", 1, 1),64000),

Case(Position(text, "5", 1, 1),Position(text, "5", 1, 1),64000),

Case(Position(text, "6", 1, 1),Position(text, "6", 1, 1),64000),

Case(Position(text, "7", 1, 1),Position(text, "7", 1, 1),64000),

Case(Position(text, "8", 1, 1),Position(text, "8", 1, 1),64000),

Case(Position(text, "9", 1, 1),Position(text, "9", 1, 1),64000),

Case(Position(text, "0", 1, 1),Position(text, "0", 1, 1),64000)

)+2

), 1)))

  • 2 weeks later...
Posted

Super User...

My apologies that the question was asked before. Back then I was to tired to look thoroughly.

Thanks for your solution.

Many thanks djogogi,

I noticed a problem when a streetname like these came up:

[color:"red"]2nd troebadoerstreet 154 - 7 gives 2 insead of 154

Is there a way to keep the starting 0?

[color:"blue"] Whereitisland 020 want it to show 020

Many thanks for your time again.

Posted

Numbers don't have leading zeros.

If you want to have a leading zero you need to convert the number to text again and add the zero.

This topic is 8018 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.