dbTalk Databases Forums  

How to ignore empty repeating fields

comp.databases.filemaker comp.databases.filemaker


Discuss How to ignore empty repeating fields in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dc
 
Posts: n/a

Default How to ignore empty repeating fields - 06-15-2010 , 05:14 PM






I am running FMP 11 and I have an email script that I would like some
help with. I can sometimes have quite a few resources assigned to one
department of a task. I have a repeating field (5 repetitions) for
resources. The resource name is their login information, and I add
the "@xx.com" in my email script. The problem is I can not seem to
get the script to ignore the repetitions if they are empty. Any
clues? Here is my "to" calculation

Database::resource[1] & "@XX.com" & "; " & Database::resource[2] &
"@XX.com"

As you can see I also need a better understanding of arrays to bring
that down to one calculation. I tried resource [1,5] and resource
[1-5], but neither of those worked. For now I'll just take getting my
email script to ignore empty repetitions if possible, but if you do
know how to tell the array how many fields to address please let me
know.

Reply With Quote
  #2  
Old   
105
 
Posts: n/a

Default Re: How to ignore empty repeating fields - 06-15-2010 , 05:46 PM






On 16/06/10 7:44 AM, dc wrote:
Quote:
I am running FMP 11 and I have an email script that I would like some
help with. I can sometimes have quite a few resources assigned to one
department of a task. I have a repeating field (5 repetitions) for
resources. The resource name is their login information, and I add
the "@xx.com" in my email script. The problem is I can not seem to
get the script to ignore the repetitions if they are empty. Any
clues? Here is my "to" calculation

Database::resource[1]& "@XX.com"& "; "& Database::resource[2]&
"@XX.com"

As you can see I also need a better understanding of arrays to bring
that down to one calculation. I tried resource [1,5] and resource
[1-5], but neither of those worked. For now I'll just take getting my
email script to ignore empty repetitions if possible, but if you do
know how to tell the array how many fields to address please let me
know.
1. why not parse the repn iterations to separate $_var and then use the
$_var in the script calc, can use If(Empty( $_var)... or the empty will
just be ignored


2. servers you right for using repeats :-)

Reply With Quote
  #3  
Old   
Your Name
 
Posts: n/a

Default Re: How to ignore empty repeating fields - 06-16-2010 , 01:47 AM



"dc" <damienvfx (AT) gmail (DOT) com> wrote

Quote:
I am running FMP 11 and I have an email script that I would like some
help with. I can sometimes have quite a few resources assigned to one
department of a task. I have a repeating field (5 repetitions) for
resources. The resource name is their login information, and I add
the "@xx.com" in my email script. The problem is I can not seem to
get the script to ignore the repetitions if they are empty. Any
clues? Here is my "to" calculation

Database::resource[1] & "@XX.com" & "; " & Database::resource[2] &
"@XX.com"

As you can see I also need a better understanding of arrays to bring
that down to one calculation. I tried resource [1,5] and resource
[1-5], but neither of those worked. For now I'll just take getting my
email script to ignore empty repetitions if possible, but if you do
know how to tell the array how many fields to address please let me
know.
You can check for an empty field with the IsEmpty function or by comparing
it to a 'nothing' value (i.e. "")., which means you can skip any empty
rpetition with something like:

If (IsEmpty(database::resource[1]); database::resource[1] & "@XX.com";
"")

BUT,
because you're adding a semi-colon between the email addresses, there's an
extra hiccup here: if the last repetition is empty you'll end up with an
extra semi-colon (which may or may not matter, depending on where the text
is going).

The easiest way to get around this is to add the semi-colon after ALL the
email addresses and then add an extra character (e.g. "$") on the end of the
calculation. This way you know the calculation will always end with ";$" and
you then use the Substitute function to remove it by replacing the ";$" with
'nothing' (i.e. "").

The other problem is when all the repetitions are empty (which may not be
possible with your data). There's a couple of ways around that, but the
easiest is to simply replace the lone "$" that results from this
circumstance with nothing as well.

This means your calculation would become:

Substitute(
Substitute(
If (IsEmpty(Dbase::resource[1]), Dbase::resource[1] & "@XX.com;", "")
&
If (IsEmpty(Dbase::resource[2]), Dbase::resource[2] & "@XX.com;", "")
&
If (IsEmpty(Dbase::resource[3]), Dbase::resource[3] & "@XX.com;", "")
&
If (IsEmpty(Dbase::resource[4]), Dbase::resource[4] & "@XX.com;", "")
&
If (IsEmpty(Dbase::resource[5]), Dbase::resource[5] & "@XX.com;", "")
&
"$",
";$", ""),
"$", "")

Note: I've used commas to separate function arguments simply to make the
email text's semi-colons more visible.

Helpfull Harry )

Reply With Quote
  #4  
Old   
Ursus
 
Posts: n/a

Default Re: How to ignore empty repeating fields - 06-16-2010 , 02:33 PM



"dc" <damienvfx (AT) gmail (DOT) com> schreef in bericht
news:4720e292-1306-4853-82a3-1c40918beec5 (AT) t26g2000prt (DOT) googlegroups.com...
Quote:
I am running FMP 11 and I have an email script that I would like some
help with. I can sometimes have quite a few resources assigned to one
department of a task. I have a repeating field (5 repetitions) for
resources. The resource name is their login information, and I add
the "@xx.com" in my email script. The problem is I can not seem to
get the script to ignore the repetitions if they are empty. Any
clues? Here is my "to" calculation

Database::resource[1] & "@XX.com" & "; " & Database::resource[2] &
"@XX.com"

As you can see I also need a better understanding of arrays to bring
that down to one calculation. I tried resource [1,5] and resource
[1-5], but neither of those worked. For now I'll just take getting my
email script to ignore empty repetitions if possible, but if you do
know how to tell the array how many fields to address please let me
know.
You really should chuck out those repeating fields. They are a paint in the
but to work with. Only use them for GUI graphics. Then as and when you
really understand their limitations you might reconsidder using them.

--
Keep well / Hou je goed

Ursus

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.