Script won't listen to me 
Author Message
 Script won't listen to me

Enter Browse Mode[]
Go to Portal Row [Select,"Purchases::fk_sale_item"]
If ["IsEmpty(Purchases::fk_sale_item)"]
   Halt Script    
End If

 rest of script

Copy [Select, "pk_id"]
etc.

This script doesn't stop when the field is blank.  I've used  Exit Script
as well but the If statment is ignored and the script continues on.

I would prefer a message to popup saying that there are no purchases but
first things first.

Can you see what I'm doing wrong?

--
Harvey Waxman
Harvey Products
Makers of DinghyDogs?
http://www.***.com/

Feeling Tipsy?
Keep On The Level

Please remove .invalid before emailing



Sun, 24 Aug 2003 00:05:25 GMT
 Script won't listen to me

Quote:

> Enter Browse Mode[]
> Go to Portal Row [Select,"Purchases::fk_sale_item"]
> If ["IsEmpty(Purchases::fk_sale_item)"]
>    Halt Script    
> End If

>  rest of script

> Copy [Select, "pk_id"]
> etc.

> This script doesn't stop when the field is blank.  I've used  Exit Script
> as well but the If statment is ignored and the script continues on.

> I would prefer a message to popup saying that there are no purchases but
> first things first.

> Can you see what I'm doing wrong?

It looks to me like you're testing the first portal row to see if there
is a value there. Unfortunately, if there is no data, the first portal
row technically doesn't exist, so it can't be tested. What you're seeing
on the screen is not an actual empty portal record, but the potential
record which Filemaker maintains for data input when you do create that
first portal row.

You can do your test in a couple of different ways.

Is Valid(Purchases:relatingfield)  tests to see if a valid relationship
exists.

I find the next one a little more reliable. Is Valid sometimes gives
problems.

Count(Purchases::relatingfield) counts each related value which exists
in the purchases db. If the count is 0, do the rest of your script.

--
Lynn Allen              Allen & Allen Semiotics
FSA Associate           Filemaker Consulting & Training



Sun, 24 Aug 2003 00:27:52 GMT
 Script won't listen to me

Quote:

>  What you're seeing
> on the screen is not an actual empty portal record, but the potential
> record which Filemaker maintains for data input when you do create that
> first portal row.

That would explain it, thanks.  Will I live long enough to ever start
thinking like a Filemaker programmer  :-)

Harvey

--
Harvey Waxman
Harvey Products
Makers of DinghyDogs?
http://www.dinghydogs.com

Feeling Tipsy?
Keep On The Level

Please remove .invalid before emailing



Sun, 24 Aug 2003 01:51:59 GMT
 Script won't listen to me

Quote:

> It looks to me like you're testing the first portal row to see if there
> is a value there. Unfortunately, if there is no data, the first portal
> row technically doesn't exist, so it can't be tested. What you're seeing
> on the screen is not an actual empty portal record, but the potential
> record which Filemaker maintains for data input when you do create that
> first portal row.

> You can do your test in a couple of different ways.

> Is Valid(Purchases:relatingfield)  tests to see if a valid relationship
> exists.

> I find the next one a little more reliable. Is Valid sometimes gives
> problems.

> Count(Purchases::relatingfield) counts each related value which exists
> in the purchases db. If the count is 0, do the rest of your script.

This doesn't work:

If ["Count(Purchase::fk_sale_item) ?0"]
  Exit script  (or Halt Script)
End If

rest of script.....

Same result.  I'm sure syntax is wrong, right?  I tried it without the
operator and '0' with the same result.  It just goes right past.

Question:  Is this step in fact an external script?

--
Harvey Waxman
Harvey Products
Makers of DinghyDogs?
http://www.dinghydogs.com

Feeling Tipsy?
Keep On The Level

Please remove .invalid before emailing



Sun, 24 Aug 2003 02:17:16 GMT
 Script won't listen to me
The test

If ["IsEmpty(Purchases::fk_sale_item)"]

fails because it doesn't know that the previous step
("Go to Portal Row [Select,"Purchases::fk_sale_item"]")
means "don't just look at the first related record". In other words, the
test

If ["IsEmpty(Purchases::fk_sale_item)"]

only evaluates the first record in the realtionship, which is probably
always not empty.

Also,

"Go to Portal Row [Select,"Purchases::fk_sale_item"]"

is meaninglesss, unless Purchases::fk_sale_item returns a number, and the
number is being used (as in, Go to Portal row, by field Value....).

If you are trying to test whether there are any purchases, you ca use either
IsValid(relationship::Purchase field), or IsEmpty(relationship::Purchase
field). They have slightly different uses and purposes.

If you are trying to test whether a specific record displayed in a portal
has a purchase, you are probably better off using a scripted find, or a
filtered relationship, i.e., a portal that displays a relationship of only
records with purchases.

--

John Weinshel
Datagrace
Associate Member, Filemaker Solutions Alliance
Vashon Island, WA
(206) 463-1634


Quote:
> Enter Browse Mode[]
> Go to Portal Row [Select,"Purchases::fk_sale_item"]
> If ["IsEmpty(Purchases::fk_sale_item)"]
>    Halt Script
> End If

>  rest of script

> Copy [Select, "pk_id"]
> etc.

> This script doesn't stop when the field is blank.  I've used  Exit Script
> as well but the If statment is ignored and the script continues on.

> I would prefer a message to popup saying that there are no purchases but
> first things first.

> Can you see what I'm doing wrong?

> --
> Harvey Waxman
> Harvey Products
> Makers of DinghyDogs?
> http://www.dinghydogs.com

> Feeling Tipsy?
> Keep On The Level

> Please remove .invalid before emailing



Sun, 24 Aug 2003 02:28:03 GMT
 Script won't listen to me
Thanks once again everyone.  Your help is on target.  I am too embarrassed
to reveal the reason why the corrected script (Count[ etc]) didn't work.  
Suffice it to say it does work as proposed.

Shoveling very heavy wet snow apparently removed all the {*filter*} from my
brain and sent it to my legs and arms and it hasn't quite returned yet.

--
Harvey Waxman
Harvey Products
Makers of DinghyDogs?
http://www.***.com/

Feeling Tipsy?
Keep On The Level

Please remove .invalid before emailing



Sun, 24 Aug 2003 02:49:47 GMT
 
 [ 6 post ] 

 Relevant Pages 

1. Won't Listen on 2nd IP for a Virtual Server

2. SQL server won't listen on port 1433

3. Ingres won't listen...!

4. Ingres won't listen...!

5. Scripts written in SQL 7.0 won't run on SQL 6.5

6. Script won't create cursor

7. ActiveX script Job won't execute

8. ActiveX script won't run

9. Simple T-SQL Script that compiles but won't execute

10. script won't create stored procedure

11. dts won't transform w/ script?

12. TRUNCATE TABLES won't work from Robot Script


 
Powered by phpBB® Forum Software