Jump to content
Server Maintenance This Week. ×

Retrieving previous field value through self join or something?


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

Recommended Posts

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:) ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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)?

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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