Disallowing spaces?!

Disallowing spaces?!

am 03.09.2007 23:46:58 von esha

Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
in fields by mistake - ie. in email addresses and URLs?

My idea was that they might write the spaces, but the formatting removes
them?!

Thx in advance!

:-) Esben

Mail: nameasofabove_h@get2net.dk

Re: Disallowing spaces?!

am 04.09.2007 00:02:36 von Howard Schlossberg

Esben wrote:
> Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
> in fields by mistake - ie. in email addresses and URLs?
>
> My idea was that they might write the spaces, but the formatting removes
> them?!

In the field definition, add an auto-enter calculation:
substitute( YourField; " ", "")
and set it to allow updating of itself.

For email fields, I also would include a calculation on the validation
tab, something like:

case(
patterncount( EmailAddress, " "), 0,
not patterncount( EmailAddress, "@"), 0,
not patterncount( right(EmailAddress, 5), "."), 0,
1)

The zeroes mean those cases are not valid; other wise it is '1' (valid).


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Member, FileMaker Business Alliance

Re: Disallowing spaces?!

am 04.09.2007 00:21:58 von esha

Howard Schlossberg wrote:

> Esben wrote:
> > Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
> > in fields by mistake - ie. in email addresses and URLs?
> >
> > My idea was that they might write the spaces, but the formatting removes
> > them?!
>
> In the field definition, add an auto-enter calculation:
> substitute( YourField; " ", "")
> and set it to allow updating of itself.
>
> For email fields, I also would include a calculation on the validation
> tab, something like:
>
> case(
> patterncount( EmailAddress, " "), 0,
> not patterncount( EmailAddress, "@"), 0,
> not patterncount( right(EmailAddress, 5), "."), 0,
> 1)
>
> The zeroes mean those cases are not valid; other wise it is '1' (valid).

Thanks! Great help!

Implemented step one - will implement the next tomorrow, as it's past
midnight here!

:-) Esben

Mail: nameasofabove_h@get2net.dk

Re: Disallowing spaces?!

am 04.09.2007 03:47:15 von bill

In article <1i3w3fi.1741i2x1n57ldmN%esha@nospamget2net.dk>,
esha@nospamget2net.dk (Esben) wrote:

> Howard Schlossberg wrote:
>
> > Esben wrote:
> > > Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
> > > in fields by mistake - ie. in email addresses and URLs?
> > >
> > > My idea was that they might write the spaces, but the formatting removes
> > > them?!
> >
> > In the field definition, add an auto-enter calculation:
> > substitute( YourField; " ", "")
> > and set it to allow updating of itself.
> >
> > For email fields, I also would include a calculation on the validation
> > tab, something like:
> >
> > case(
> > patterncount( EmailAddress, " "), 0,
> > not patterncount( EmailAddress, "@"), 0,
> > not patterncount( right(EmailAddress, 5), "."), 0,
> > 1)
> >
> > The zeroes mean those cases are not valid; other wise it is '1' (valid).
>
> Thanks! Great help!
>
> Implemented step one - will implement the next tomorrow, as it's past
> midnight here!
>
> :-) Esben
>
> Mail: nameasofabove_h@get2net.dk

Can also use the Trim function in an auto-enter calc. It just removes
leading and trailing spaces, not spaces in the middle.

--
For email, change to
Bill Collins

Re: Disallowing spaces?!

am 04.09.2007 07:13:01 von Helpful Harry

In article <13dp13vi14q3i69@corp.supernews.com>, Howard Schlossberg
wrote:

> Esben wrote:
> > Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
> > in fields by mistake - ie. in email addresses and URLs?
> >
> > My idea was that they might write the spaces, but the formatting removes
> > them?!
>
> In the field definition, add an auto-enter calculation:
> substitute( YourField; " ", "")
> and set it to allow updating of itself.
>
> For email fields, I also would include a calculation on the validation
> tab, something like:
>
> case(
> patterncount( EmailAddress, " "), 0,
> not patterncount( EmailAddress, "@"), 0,
> not patterncount( right(EmailAddress, 5), "."), 0,
> 1)
>
> The zeroes mean those cases are not valid; other wise it is '1' (valid).

That last validation test might need some modification - 5 characters
isn't enough to cover some of the newer domain name suffixes that are
being added (eg. fred@flintstone.school)

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)

Re: Disallowing spaces?!

am 07.09.2007 15:53:42 von 12Fingers

I am a big fan of the "Filter" function.

Add in you field definition the calculation:
Filter(email_address,"0123456789abcdefghijklmnopqrstuvwxyz@_ -.")

This should eliminate any unwanted characters.




Bill wrote in
news:bbcollins-686B85.21471503092007@032-478-847.area7.spcsd ns.net:

> In article <1i3w3fi.1741i2x1n57ldmN%esha@nospamget2net.dk>,
> esha@nospamget2net.dk (Esben) wrote:
>
>> Howard Schlossberg wrote:
>>
>> > Esben wrote:
>> > > Can I (FM9 adv on Mac) disallow spaces to keep users from
>> > > entering them in fields by mistake - ie. in email addresses and
>> > > URLs?
>> > >
>> > > My idea was that they might write the spaces, but the formatting
>> > > removes them?!
>> >
>> > In the field definition, add an auto-enter calculation:
>> > substitute( YourField; " ", "")
>> > and set it to allow updating of itself.
>> >
>> > For email fields, I also would include a calculation on the
>> > validation tab, something like:
>> >
>> > case(
>> > patterncount( EmailAddress, " "), 0,
>> > not patterncount( EmailAddress, "@"), 0,
>> > not patterncount( right(EmailAddress, 5), "."), 0,
>> > 1)
>> >
>> > The zeroes mean those cases are not valid; other wise it is '1'
>> > (valid).
>>
>> Thanks! Great help!
>>
>> Implemented step one - will implement the next tomorrow, as it's past
>> midnight here!
>>
>> :-) Esben
>>
>> Mail: nameasofabove_h@get2net.dk
>
> Can also use the Trim function in an auto-enter calc. It just removes
> leading and trailing spaces, not spaces in the middle.
>

Re: Disallowing spaces?!

am 08.09.2007 16:11:54 von esha

Brent Simon wrote:

> I am a big fan of the "Filter" function.
>
> Add in you field definition the calculation:
> Filter(email_address,"0123456789abcdefghijklmnopqrstuvwxyz@_ -.")
>
> This should eliminate any unwanted characters.

will add that one!

thanks

Esben

Re: Disallowing spaces?!

am 13.09.2007 21:22:55 von esha

Brent Simon wrote:

> I am a big fan of the "Filter" function.
>
> Add in you field definition the calculation:
> Filter(email_address,"0123456789abcdefghijklmnopqrstuvwxyz@_ -.")
>
> This should eliminate any unwanted characters.

Made and import with this filter and it parsed email addresses wrongly,
so I don't think I dare use it.

if a "-" or "." were present after an before "@" respectively the two
characters around the above character was removed in the import.

Esben

Re: Disallowing spaces?!

am 08.10.2007 15:28:27 von esha

Bill wrote:

> In article <1i3w3fi.1741i2x1n57ldmN%esha@nospamget2net.dk>,
> esha@nospamget2net.dk (Esben) wrote:
>
> > Howard Schlossberg wrote:
> >
> > > Esben wrote:
> > > > Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
> > > > in fields by mistake - ie. in email addresses and URLs?
> > > >
> > > > My idea was that they might write the spaces, but the formatting removes
> > > > them?!
> > >
> > > In the field definition, add an auto-enter calculation:
> > > substitute( YourField; " ", "")
> > > and set it to allow updating of itself.

> Can also use the Trim function in an auto-enter calc. It just removes
> leading and trailing spaces, not spaces in the middle.

I have a field where a "," is a prevalence but entered by the users (and
therefore unstructured). Can I force multiple substitutions (or other
functions) after each other to ensure that before a komma, there will
never be a space, but after the komma there will always be one?

Thx in advance!

:-) Esben

Mail: nameasofabove_h@get2net.dk

Re: Disallowing spaces?!

am 08.10.2007 16:04:23 von bill

In article <1i4jayz.1trvcrhhliujN%esha@nospamget2net.dk>,
esha@nospamget2net.dk (Esben) wrote:

> Bill wrote:
>
> > In article <1i3w3fi.1741i2x1n57ldmN%esha@nospamget2net.dk>,
> > esha@nospamget2net.dk (Esben) wrote:
> >
> > > Howard Schlossberg wrote:
> > >
> > > > Esben wrote:
> > > > > Can I (FM9 adv on Mac) disallow spaces to keep users from entering
> > > > > them
> > > > > in fields by mistake - ie. in email addresses and URLs?
> > > > >
> > > > > My idea was that they might write the spaces, but the formatting
> > > > > removes
> > > > > them?!
> > > >
> > > > In the field definition, add an auto-enter calculation:
> > > > substitute( YourField; " ", "")
> > > > and set it to allow updating of itself.
>
> > Can also use the Trim function in an auto-enter calc. It just removes
> > leading and trailing spaces, not spaces in the middle.
>
> I have a field where a "," is a prevalence but entered by the users (and
> therefore unstructured). Can I force multiple substitutions (or other
> functions) after each other to ensure that before a komma, there will
> never be a space, but after the komma there will always be one?
>
> Thx in advance!
>
> :-) Esben
>
> Mail: nameasofabove_h@get2net.dk

As Howard wrote, you can use auto-enter calculation to force this kind
of thing in a text field. The more you want to do in one field, the more
complex the calculation becomes.

You might want to think about a different approach, which would be to
provide several different fields to hold different parts of the text
that would normally be separated by commas. So for example in a postal
address which when fully displayed would include commas, for example:

City, State PostCode

define different fields for City, State and PostCode, and impose
formatting requirements on each, without commas. Then when you want to
use that data to construct a complete address, use a calculation field
that concatenates the several parts with appropriate commas, other
punctuation, and spaces.

--
For email, change to
Bill Collins

Re: Disallowing spaces?!

am 08.10.2007 17:01:56 von Howard Schlossberg

Esben wrote:
>>> Howard Schlossberg wrote:
>>>
>>>> Esben wrote:
>>>>> Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
>>>>> in fields by mistake - ie. in email addresses and URLs?
>>>>>
>>>>> My idea was that they might write the spaces, but the formatting removes
>>>>> them?!
>>>> In the field definition, add an auto-enter calculation:
>>>> substitute( YourField; " ", "")
>>>> and set it to allow updating of itself.
>
> I have a field where a "," is a prevalence but entered by the users (and
> therefore unstructured). Can I force multiple substitutions (or other
> functions) after each other to ensure that before a komma, there will
> never be a space, but after the komma there will always be one?

This will get rid of all spaces and then replace any commas with a comma
followed by a space:

substitute( YourField; [" "; ""]; [","; ", "] )

Re: Disallowing spaces?!

am 08.10.2007 23:27:38 von esha

Howard Schlossberg wrote:

> Esben wrote:
> >>> Howard Schlossberg wrote:
> >>>
> >>>> Esben wrote:
> >>>>> Can I (FM9 adv on Mac) disallow spaces to keep users from entering them
> >>>>> in fields by mistake - ie. in email addresses and URLs?
> >>>>>
> >>>>> My idea was that they might write the spaces, but the formatting removes
> >>>>> them?!
> >>>> In the field definition, add an auto-enter calculation:
> >>>> substitute( YourField; " ", "")
> >>>> and set it to allow updating of itself.
> >
> > I have a field where a "," is a prevalence but entered by the users (and
> > therefore unstructured). Can I force multiple substitutions (or other
> > functions) after each other to ensure that before a komma, there will
> > never be a space, but after the komma there will always be one?
>
> This will get rid of all spaces and then replace any commas with a comma
> followed by a space:
>
> substitute( YourField; [" "; ""]; [","; ", "] )

Problem is that spaces are allowed too (maybe it's a bit confusing, that
I continued in this thread, as the problem is different).

But maybe this would work:

substitute( FieldName; [" ,"; ","]; [","; ", "] [", "; ", "])

the third one would then remove extra spaces that the second might
create.

I assume the substitutions are executed in the order written...?!

:-) Esben

Mail: nameasofabove_h@get2net.dk

Re: Disallowing spaces?!

am 08.10.2007 23:27:39 von esha

Bill wrote:

> In article <1i4jayz.1trvcrhhliujN%esha@nospamget2net.dk>,

> > I have a field where a "," is a prevalence but entered by the users (and
> > therefore unstructured). Can I force multiple substitutions (or other
> > functions) after each other to ensure that before a komma, there will
> > never be a space, but after the komma there will always be one?

> As Howard wrote, you can use auto-enter calculation to force this kind
> of thing in a text field. The more you want to do in one field, the more
> complex the calculation becomes.
>
> You might want to think about a different approach, which would be to
> provide several different fields to hold different parts of the text
> that would normally be separated by commas. So for example in a postal
> address which when fully displayed would include commas, for example:
>
> City, State PostCode
>
> define different fields for City, State and PostCode, and impose
> formatting requirements on each, without commas. Then when you want to
> use that data to construct a complete address, use a calculation field
> that concatenates the several parts with appropriate commas, other
> punctuation, and spaces.

Yes, I think that is the general right direction to go!

In this case it's streetname and number and placement in the building
(or apartment number). I'd love to chop up the input into fields with
value lists or validations and then make a cancatenated field for
ordinary display of the data, but can't have it my way as the people
typing wouldn't accept that.

But thanks for your input!

:-) Esben

Mail: nameasofabove_h@get2net.dk

Re: Disallowing spaces?!

am 09.10.2007 01:53:38 von Helpful Harry

In article <1i5opgc.vyctxm1e323tkN%esha@nospamget2net.dk>,
esha@nospamget2net.dk (Esben) wrote:

> Howard Schlossberg wrote:
>
> > Esben wrote:
> > >>> Howard Schlossberg wrote:
> > >>>
> > >>>> Esben wrote:
> > >>>>> Can I (FM9 adv on Mac) disallow spaces to keep users from entering
> > >>>>> them
> > >>>>> in fields by mistake - ie. in email addresses and URLs?
> > >>>>>
> > >>>>> My idea was that they might write the spaces, but the formatting
> > >>>>> removes
> > >>>>> them?!
> > >>>> In the field definition, add an auto-enter calculation:
> > >>>> substitute( YourField; " ", "")
> > >>>> and set it to allow updating of itself.
> > >
> > > I have a field where a "," is a prevalence but entered by the users (and
> > > therefore unstructured). Can I force multiple substitutions (or other
> > > functions) after each other to ensure that before a komma, there will
> > > never be a space, but after the komma there will always be one?
> >
> > This will get rid of all spaces and then replace any commas with a comma
> > followed by a space:
> >
> > substitute( YourField; [" "; ""]; [","; ", "] )
>
> Problem is that spaces are allowed too (maybe it's a bit confusing, that
> I continued in this thread, as the problem is different).
>
> But maybe this would work:
>
> substitute( FieldName; [" ,"; ","]; [","; ", "] [", "; ", "])
>
> the third one would then remove extra spaces that the second might
> create.
>
> I assume the substitutions are executed in the order written...?!

I would guess they do, but I'm assuming the structure of the Substitute
command above is what newer versions of FileMaker understand. If they
don't you can use the older nested Substitute commands method to make
sure they do work as wanted.
ie.
Substitute(Fieldname;
Substitute(Fieldname;
Substitute(Fieldname, " ,"; ",");
","; ", ");
", "; ", ")

with the nested commands working from the middle outwards.

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)

Re: Disallowing spaces?!

am 09.10.2007 21:18:18 von esha

> In article <1i5opgc.vyctxm1e323tkN%esha@nospamget2net.dk>,
> esha@nospamget2net.dk (Esben) wrote:
>
> > Howard Schlossberg wrote:
> >
> > > Esben wrote:
[snip old thread]
> > > > I have a field where a "," is a prevalence but entered by the users (and
> > > > therefore unstructured). Can I force multiple substitutions (or other
> > > > functions) after each other to ensure that before a komma, there will
> > > > never be a space, but after the komma there will always be one?
> > >
> > > This will get rid of all spaces and then replace any commas with a comma
> > > followed by a space:
> > >
> > > substitute( YourField; [" "; ""]; [","; ", "] )
> >
> > Problem is that spaces are allowed too [snip]
> >
> > But maybe this would work:
> >
> > substitute( FieldName; [" ,"; ","]; [","; ", "] [", "; ", "])
> >
> > the third one would then remove extra spaces that the second might
> > create.
> >
> > I assume the substitutions are executed in the order written...?!

Yeah, it works! (except I forgot a ";" above)

Now my final problem - the field calculation looks like this now:

---
TextFormatRemove (
Trim (
Substitute (Home Street;
[" ,"; ","]; [","; ", "]; [", "; ", "];
[" ."; "."]; ["."; ". "]; [". "; ". "];
[" tv "; " tv. "]; [" th "; " th. "]; [" mf "; " mf. "];
[" lejl "; " lejl. "]; [" lejlighed "; " lejl. "];
[" nr "; " "];
[".."; "."]; [",,"; ","]
)
)
)
---

the "tv" line indicates left/right/middle in Danish ("lejlighed" btw
means apartment) and will often appear as the last information. Problem
is there won't be a space in the end (even if added it will be trimmed)
to tell the calculation to add a "."

So is there a way to calculate on the last three characters (a space +
tv/th/mf) to add the final period? - and can it be done without creating
costum functions?

Something with Right (3;?;?)...?!

Any help appreciated!

:-) Esben

Mail: nameasofabove_h@get2net.dk