Jump to content
Server Maintenance This Week. ×

Dynamic Audit Trail / Global Calc technique


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

Recommended Posts

Hello everybody,

PLEASE DOWNLOAD THE ATTACHMENT AND TAKE A LOOK.

I think this has the potential to be the most important post that i will ever make (a big statement huh)

A while ago i posted a question: anyone know any uses for calculations that are stored globally... no replies which i thought was interesting.

Well i did some playing around since then and found that it is very very powerful.

Here is an example of a really simple to deploy and dynamic audit trail/change log. Its not perfect but it is the technique that i think is the exciting part.

I have been unable to test this on a network but in theory i see no reason that the global field would not change on the network for everyone rather than just on the local machine ... which means the results will be stored when the file is closed.

here are a few tips and ideas for global calculations if the theory about the network is correct.

1. If you set a global calculation to calculate a non global text field it updates every time you change that field on any record.

2. you may be able to track the current record of all users on the network which may be useful in terms of avoiding record access errors.

3. you could track the current activity of all users by specifying the global calculation to update based on any states that change at all.

4. You can set globals across a network which would be great for layout mode.

5. You could send messages across a network

OK i know these things will work on one machine and the network thing is theory so please could someone test this.

please see attachment below:

best Stuart

Global_Calculation.fp7.zip

Link to comment
Share on other sites

I Think for any developer Calculations set as global are worth a play.

Here are the custom function calcs for anyone interested that dont have FM Advanced:

--------------------------------------------

Record_Log (fieldName)=

Evaluate (

Substitute (

Substitute (

Substitute (

Substitute ( "Label_Field ("" & fieldNames ( Get ( fileName ) ; Get ( LayoutName ) ) & "¶;"

; "Record_Log¶" ; "" )

; "¶" ;

"") & "

& Quote ( ¶ ) &

" & Label_Field (""

)

; "<;" ; ";" )

; "& " & Quote( ¶ ) & " & Label_Field (";" ; "" )

)

-----------------------------------

Label_Field ( fieldName ) =

TextStyleAdd (

fieldName & ":¶" ; Bold )

& GetField ( fieldName )

------------------------------------

Link to comment
Share on other sites

Notes on Record_Log function:

(ps the field name is used as the update trigger and is nothing to do with the calculation itself ... i use the timestamp_modified as a trigger to make it more dynamic but you could just specify the fields that you want to set off the trigger when modified.

Record_Log ( field_1 & field_2 & field_3 )

Im sure it could be further modified to specify the fields to update on the log.

Rather than specifying field names in a text box you could just make create another layout with just the fields you want to update on them ...

The Function would be as follows:

Record_Log (fieldName;LayoutName)=

Evaluate (

Substitute (

Substitute (

Substitute (

Substitute ( "Label_Field ("" & fieldNames ( Get ( fileName ) ; LayoutName ) & "¶;"

; "Record_Log¶" ; "" )

; "¶" ;

"") & "

& Quote ( ¶ ) &

" & Label_Field (""

)

; "<;" ; ";" )

; "& " & Quote( ¶ ) & " & Label_Field (";" ; "" )

)

By doing this you could add calculation result not on your layout with ID codes, colored text and warnings to further enhance your log. You can also omit UI fields without calculating them out.

I feel a little like im talking to myself ... oh i am ;)

Link to comment
Share on other sites

I suppose you could instead use this technique in combination to a plugin and post to a central field anytime the global calc field updates.

I'm not 100% certain i see the exciting part though. But if there is one, could you put it in a couple of sentences?

Link to comment
Share on other sites

Hi Let me explain the reason for my excitement.

(please know that i am not actually interested in the log, just the behavior of the global calculation. (the log field could be exported as a file or a field could be set at the end of a session...i realise its probably bug ridden but do not have the environment to test)

My reasoning is as follows. but i can not test it on the network:

Usually a global field is specific only to the session of the user logged in. This makes it impossible to get information about the current status information of other users or share global field information.

But although i can not test it, i believe the following may happen with this kind of global calculation.

As the update of the global calculation is triggered by any change in a table ... and changes that happen on individual records update on the fly across the network ... any change on any record should trigger the global calculation to update.

This means that the global field will effectively be updates to all users logged in across the network at the same time.

Therefore you can set/change a global field across the network

I think that is exciting. (only if i'm right of course)

I can see instant messaging

Global Field labels changing of the fly and being viewable in find mode.

All of the labels in my entire database changing by just choosing the language from a field (with no script needed) ... and it will work in find mode.

Users seeing people logging on and off

Administrators tracking user activity on the fly based on any kind of activity.

Just a few ideas ... i could be totally wrong here!

Link to comment
Share on other sites

Nice thought. Unfortunately, though, it doesn't work across the network. Tested the concept using your file and found that the it wouldn't update at all on the client computer unless both the host file and client file were closed and re-opened (closing and re-opening the file only on the client computer didn't work). Furthermore, committing records and flushing cache to disk on either computer had no effect on the result. Sorry.

Link to comment
Share on other sites

Thanks for taking a look ... sound like you are working on a peer to peer network.

Not that it will make a massive difference but i would only deploy this on a server to peer setup.

Not so bothered about the file attached persay ... but still have a sneeking suspision that with a but of tweeking you could get it to update across the network.

Just wish i had the network setup.

Link to comment
Share on other sites

To further clarify for test purposes

The objective here is not to get the global calculation to store the data across the network ... this can not be done without additional scripting.

The test procedure should be as follows.

Host the file with FileMaker Server

Open the file on 2 client machines A & B

Both files are now open on the network.

make a change to a record on machine A

This will trigger the Global Calc to update on machine A

Now go to machine B ... has the global calculation updated to reflect the change made on machine A?.

If so it is working.

Link to comment
Share on other sites

  • 1 month later...

make a change to a record on machine A

This will trigger the Global Calc to update on machine A

Now go to machine B ... has the global calculation updated to reflect the change made on machine A?.

No. The global will store separate info for each user. If I put info into a global froma cleint machine, it will only be visisble to me, not to anyone else.

If you put info into a gloabl BEFORE you host it up to a server, then it is visible to all.

Glonbals in a server kinda work like $$Variables. It is a way for the user to pass info to themself between records though, it would just need to be put into a non-global at some point for others to use it.

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...

Important Information

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