Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I have been away from FMP for a long time, and am now jumping back in. RIght away, I ran into a problem. This is a simple script step to increment a counter, but it does nothing.

 

Case (PETER ZIPPI FILE::SOURCE OF INTAKE="STRAY - AT LARGE"; PETER ZIPPI FILE::Q1 Strays=PETER ZIPPI FILE::Q1 Strays+1)

 

The record has the right data in the SOURCE OF INTAKE field, so why doesn't this increment the counter?

 

Feeling stupid in LA

Posted

Look at this:

 

PETER ZIPPI FILE::Q1 Strays=PETER ZIPPI FILE::Q1 Strays+1

 

It is like someone says:

 

a = a + 1

Posted

OK, but what about the conditional? What you see above is a fragment that I need to turn into a lengthy script, and I need to test the SOURCE OF INTAKE field each time.

Posted

Explain what you want to happen.

 

As Danielle said, your current expressions says:

 

If the source of intake is stray at large then evaluate the expression "Q1 Strays" = "Q1 Strays" + 1.

 

You probably need the script to look like this:

 

If [ PETER ZIPPI FILE::SOURCE OF INTAKE="STRAY - AT LARGE" ] 

Set Field [ Q1 Strays ; Q1 Strays + 1 ]

End If

 

There are other ways of doing it, for instance the conditional IF could be inside the Set Field step.

Posted

Still having problems. I rewote the script as follows:

 

Go to Rrcord/Request/Page [First]

Set Field [PETER ZIPPI FILE::Q1 Strays[0]]

If [PETER ZIPPI FILE::SOURCE OF INTAK = "STRAY - AT LARGE"]

   Set Field [PETER ZIPPI FILE::Q1 STRAYS = PETER ZIPPI FILE::Q1 STRAYS +1]]

   Loop

      Go to Rrcord/Request/Page [Next, Exit after last]

      If [PETER ZIPPI FILE::SOURCE OF INTAK = "STRAY - AT LARGE"]

        Set Field [PETER ZIPPI FILE::Q1 STRAYS = PETER ZIPPI FILE::Q1 STRAYS +1]]

     End If

   End Loop

End If

 

This script (like others before) runs, but does not change the counter field. I am attaching a copy of the file, if you care to look at it.

 

Any new ideas??

PETER ZIPPI FILE.zip

Posted

the very first set field step is incomplete and won't do anything - if you want to set the first record's field to 0, that step should read:

 

Set Field [PETER ZIPPI FILE::Q1 Strays; 0]

 

you don't want the = in there - Set Field [PETER ZIPPI FILE::Q1 STRAYS = PETER ZIPPI FILE::Q1 STRAYS +1]]

 

When you are setting a field with a value, you write the name of the field PETER ZIPPI FILE::Q1 STRAYS then a ; then the value so the set field step should look like:

 

Set Field [PETER ZIPPI FILE::Q1 STRAYS; PETER ZIPPI FILE::Q1 STRAYS +1]

 

you also have an extra ]

 

this is what Vaughan said above also.

 

hth,
Martie

 

Posted

OK, I think this is waht you meant:

 

Go to Rercord/Request/Page [First]
Set Field [PETER ZIPPI FILE::Q1 Strays; 0]
If [PETER ZIPPI FILE::SOURCE OF INTAKE = "STRAY - AT LARGE"]
   Set Field [PETER ZIPPI FILE::Q1 STRAYS; PETER ZIPPI FILE::Q1 STRAYS +1]
   Loop
      Go to Rercord/Request/Page [Next, Exit after last]
      If [PETER ZIPPI FILE::SOURCE OF INTAKE = "STRAY - AT LARGE"]
   Set Field [PETER ZIPPI FILE::Q1 STRAYS; PETER ZIPPI FILE::Q1 STRAYS +1]
     End If
   End Loop
End If

 

But it still does nothing.

 

Thank so much for your patience. Please bear with me, I am going through a bout of Cancer, and I think the radiation has fried my brain.

Posted

i just re-read your original post and saw the bit about wanting a counter (duh!). This script (as written) will set each field to 1 - it will not increment.

 

If you want each record to have a new number (0, 1, 2, 3, 4 etc), you need another field - a global field -- PETER ZIPPI FILE::G_Q1Strays

 

Then, you go to the first record - set the Q1 Strays field to 0 as you have done and write the if statement as you have done - if source of intake = stray at large, add 1 to the Q1 Strays. But, then, you need to set the global field to this new number --- Set Field [PETER ZIPPI FILE::G_Q1Strays; PETER ZIPPI FILE::Q1Strays]

 

Start your loop - as you have

 

on the next record, if source of intake = stray at large - Set Field [PETER ZIPPI FILE::Q1Strays; PETER ZIPPI FILE::G_Q1Strays+1] and then Set Field [PETER ZIPPI FILE::G_Q1Strays; PETER ZIPPI FILE::Q1Strays]

 

What this will do is give you a count - each time the source of intake = stray at large, the Q1 Stray field will be advanced by 1 and the global field will be reset to the new number -- so that the next record with that criteria will move on by 1.

 

sorry to hear about the cancer and radiation - hoping for a total cure real fast for you!

 

hth,

Martie

This topic is 4284 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.