Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

Look at this:

 

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

 

It is like someone says:

 

a = a + 1

  • Author

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.

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.

  • Author

Thanks, I'm pretty sure that will work - I've been away so long I have forgotten all the basic stuff.

  • Author

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

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

 

  • Author

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.

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.