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

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

Recommended Posts

Posted

I created a button that opens a pdf in acrobat reader using a field with the filename and the Open URL script . There is a different pdf for each record. Now what I need to do is make a counter to see how many times the button was clicked on. I need to find the total for all records together, as well as for each individual record. Any help would be much appreciated.

Posted

If you just want to check how many times the button was clicked on, create a global number field "counter", and put this script into your script, Set Field[counter , counter + 1]. when user click it will automatic calculate the counter plus 1.

Regards,

Henry

Posted

You don't want to use a global in this case because a global, being global, isn't specific to any record. You'd want a regular number field so that you'd have a count per record of how many times the relevant PDF was viewed.

Posted

Thanks, it worked perfectly to find out how many times any button was clicked in the entire database. Now my question is how to apply this to each specific record. So I can find out how many times each pdf was viewed for each record.

Posted

OK, the global one works on my test database. But when I place it in the working database, the counter works, but does not save the count. The next time I open the database, the counter is reset to a blank field. I have checked the field it is set to global, number. I used the Set Field[counter , counter + 1] and placed that into the Open URL script.

I am also using the counter for a single record like John dsecribed and it works and the next time I open it the count is correct.

I acquired this database from someone else who developed it. I am not sure if a script is automatically clearing it, or something else. Like I said I am confused it works on my test database but the working database.....? Hopefully someone can help.

Posted

Actually the counter global field is use as a temporary variable. Just like for network environment, every user will get the different result even they are using the same global field. For your case, i think there have some script to clear the field, because as normal the system will not clear the field automatically by itself.

Regards,

Henry

Posted

Do you delete all records at the end of the day in this database? To store values in a global fiel there need to be at least one record in the database.

I don't think that a script in a database that you inherited can clear your new field (unless you renamed an old field for the global).

Posted

Any global field will be empty at the start of a new session unless a value is entered when the file is in single user mode. You don't need ANY records in a db to enter values into a global.

Posted

You could create a number calculation field that returns the value "1" (cConstant) and then create a selfjoin relationship where the key field and foreign field are both the "1" calculation (SELF_cConstant_to_cConstant) and then create another number calculation (cCounter)???

Sum(SELF_cConstant_to_cConstant::Counter)

Posted

I never, so far delete any records, they stay so that I have a history of the procedures I link to (the pdf's). I need to keep a count of the clicks to all pdf's, which would be the global, and for each specific pdf.

Another issue I have come across is, if someone uses the no password to enter the db, and then they click on the button to view the pdf, a message box appears saying: "Your password does not enable you to do this, or this file is not modifiable". They click ok and they open Adobe Acrobat, but the counter for the specific record does not work. The old value remains, but the global one changes. Now when I enter with my password, then the script works, except for the fact that the global goes back to an empty field when I re-opened the db.

Any suggestions. Thanks in advance.

Posted

John, I'm trying to follow you, but I think I'm going to have to think about what you are saying for a while. Could you provide a little more detail.

I'm sorry for my ignorance but thankful for any help. So far my learning curve has been very steep, thanks to you guys.

Posted

Sure. Since you're having trouble with your global, this is just another way to capture the total number of times the button has been pushed, across the entire database. The basic idea is that you're going to create a calculation that adds up all the individual record's counter values. To do that, you need a way of looking at all the records in the database.

Create a calculation field, call it cConstant. In the calculation's definition simply enter the number "1". Now all your records will have a value in common because the calculation field will calculate the same value for every record.

Now go to Define Relationships and where you specify the database, select the database we're working on. You'll then be prompted to specify the fields that the relationship is based on. You'll see two lists of fields, one on the left, and one on the right. Find cConstant in the left field list and click once to select it. Then find cConstant in the right field list and click once to select it. You just created a relationship. Because your source db is the same as your target db, this is called a self join. Give your relationship a name that will make sense to you. When I name my relationships, I specify both the left-hand field and the right-hand field names, as well as the name of the target db. (I do this because sometimes relationships can get hosed, but it's rare that the name will ever get hosed, so by including the name of the target db as well as the fields involved, I can quickly resurrect the relationship.) Since this is a self join, I'd name it "SELF_cConstant_to_cConstant".

OK, so now you've created a way for the database to look at itself and consider all the records, found or not.

Now you just need to create a calculation that looks at all the records totals up the values in your individual records' counter field (and I'm assuming your counter field is called Counter). Call this calculation cTotalCounter, and in its definition type the following:

Sum(SELF_cConstant_to_cConstant::Counter)

Place the field somewhere on your layout and press the PDF button a few times on different records.

Posted

It sounds like either the no password option does allow for record editing, or the no password is linked to a group that may allow record editing for select fields and your counter field may not be setup to be editable.

Posted

Now I'm following you. Lots of little words helps my brain. I will try it on my test db. The working db is located on the FMpro server and our administrator is off until Monday. So until then i have to work with my test located on my C drive. I believe it should still work.

I am still working on the no-password problem. I have looked into the test db about the password problem. And after reconfiguring it what seemed like a few thousand times I think I figured it out. And John you are correct. I know I have to give some editing capability to the no-password and then in a layout they are able to view turn off the allow entry into filed under the behaviors for field format. I think this might solve my no-password issues.

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