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.

Retrieving previous field value through self join or something?

Featured Replies

hello everybody

 

 

I am pretty sure, that I've read about a technique that allows me to do the following, but I cannot figure it out.

 

 

 

1. I have a field with the value "a" in it. This field has a OnObjectSave trigger.

2. Now I change the value to "b" and the trigger fires.

 

While the linked script behind the trigger is running, I am sure I read somewhere that I should be able to retrieve the old value "a" through a relationship somehow.

 

So...is it possible to retrieve an old value BEFORE a record is commited ?

 

 

 

Anyone any ideas:) ?

Huh? Pass the current value to the trigger script using a script parameter.

  • Author

ahh sorry.. I removed the post.

 

but yes. If you use a field and apply a popup valuelist or calendar to it, you can catch the prior value. if you need an example. i can show you.

 

It works with the OnModifyObject trigger.

Could you post a demo file? Why would you apply a calendar to a non-date field in order to "capture" the original value prior to an edit?

What do you mean?

 

 

ahh sorry.. I removed the post.

The blog post simply tells you to pass the original value as a scriptparameter which is exactly what I said. It has nothing to do with how the field is formatted and certainly doesn't suggest using a calendar for a non-date field.

I am confused here ... there are a few ways to capture the prior value from a field using script parameter (as Barbara mentioned).  You can even using OnObjectEnter (with pop-up) to use script parameter to set a global variable from the prior value (although script fires AFTER the value changes).  So the type of field CAN make a difference in how you might wish to configure it.  You also need to consider whether you have layout setup checked 'save changes automatically' - they all work together to provide a good solution but we do not yet know the problem.

 

The issue I see with the technique referenced is that it changes the modification timestamp on the record and the value didn't actually change and accurate modification timestamps are important. I would rather use Revert Record/Request[] instead of their script's 'Set Field[] and then Commit'.

 

Electric Soul, there are two distinct issues here:

  1. Capture prior value:  You can capture prior value before commit but the best method would be determined on a) layout setup of 'save changes', b )  field control type (whether edit, pop-up etc), 3) the purpose of your OnObjectSave script.
  2. Display of prior value:  You can display the prior value on your layout using either a merge variable or a self-join relationship (and placing the self-join's same-field on the layout).  Again, the best method would depend upon all of the factors mentioned.

More information is need.  And yes, I read your opening post and so did Barbara and Lee.  :laugh2:

 

If you provide a simple demo of your question, we can provide a specific, good solution; in fact I started a sample file but I do not have enough information to complete it.

Edited by LaRetta

  • Author

Hey

 

@Everybody

I am sorry for the confusion. I need to chose my words more wisely :)

 

I am looking for a method that allows me to retrieve a previous value from a field WHILE editing(by hand or script) and BEFORE commit a record.

 

So all methods, except post 6, that retrieve a previous value before I even start typing/running a script do not come into play. I was pretty sure, that I've read about a method that would allow this using relationships.

Have you tried what is being suggested? So even if everything we say fails what is wrong with post 6? Again, it is not clear for me what you want, sorry.

  • Author

@LaRetta

 

I am using 6, but I was hoping for slightly better way.

 

I am looking for a method that doesn't involve to much "playing around". In my opinion Filemaker is too much about playing around and finding workarounds. In this case, if a record is not commited yet, then I think it should be possible to retrieve the current value somehow. 

 

 

PLUS, ....I am sorry, I skipped your suggestion. So I can see the prior value through a self-join if it's on the same layout. But this seems to apply only to my eyes right? Using a script, I always get the currently typed and not commited value. Is there a way to make a script see those prior values?

To get the prior value you'll need to "remember" it somehow BEFORE it is edited.

 

FileMaker is not playing around. It is simple but logical.

 

Try this yourself:

 

1) Pick something up with your hand.

2) Drop it and pick something else up.

3) Tell me what was previously in your hand.

 

You cannot tell what was in your hand unless you had a process that remembered what was there before changing it.

 

 

FileMaker can only tell you what is in the field NOW not what used to be in there.

 

1) Pick something up with your hand. 

2) Remember what is in your hand.

3) Drop it and pick something else up. 

4) Tell me what was previously in your hand by accessing the remembered value.

 

You can now tell me what was there before because you explicitly remembered it.

 

FileMaker it is a development environment and YOU are the developer. If you want something to happen then you need to make it happen.

  • Author

nope, but I am glad Filemaker supports transaction. :)  

 

I am only looking for what is described in my first post. i am not looking for other ways to achieve my goal. I only had a vague memory of such a method. And I think LeRetta helped me out here.

 

LaRetta(Post #8) came close with his second suggestion, but unfortunately the prior value can only be seen with the eye, but not with a script :)

You miss the point ... You CAN see the value via script before changing it. You have not provided a specific example file. If you do, we will show you how. :-)

LaRetta(Post #8) came close with his second suggestion

 

LaReta isn't a he, although one could be misled by the Pink Yoda icon. LOL

  • Author

@LaRetta

 

Oki...  "her" ...np :)

 

Example file? Well....     this would be a database with a single field and single record :)

 

Scenario:

Somebody is editing this field. The record is open, not commited. Now I run a script by picking it from the top script menu. I want this script to retrieve the previous value from this open record.

Okay, we are moving forward now ... why do you want the prior value - what is the User experiencing? I do not ask to snoop; only to understand the work flow.

BTW, I am NOT in any way related to Yoda - my mamma swears she never even met the man so ... I am a cat ... clearly.

ADDED: Also, what is the data type of the field and is there a control attached (pop-up, radio button etc)?

  • Author

Well I am building something, but my question is pure interest. I was simply wondering, if I can avoid the hassle with catching pervious values in variables and such.

 

 

I am simply here to learn if there is such a techique :)

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.