Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuHasBeenSaved() Topic is solved

Questions related to using nuBuilder Forte.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

nuHasBeenSaved()

Unread post by toms »

Hi,

Two situations where the window.nuTimesSaved counter should not be incremented:

1.
After a Clone Action has taken place, nuHasBeenSaved() should return 0.

(window.nuTimesSaved = 0;)

Edit: As I see, this has been solved, it's on Github.

2.
When a new record is opened and then, if the unsaved record is refreshed (Options Menu -> Refresh or Ctrl + Shift + R) nuHasBeenSaved() is incremented.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuHasBeenSaved()

Unread post by admin »

toms,

Try it now.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: nuHasBeenSaved()

Unread post by toms »

hmmm, nuHasBeenSaved() still returns 1 after a refresh.

1. Open a new or existing record
2. nuHasBeenSaved() returns 0
3. Refresh the record
2. nuHasBeenSaved() returns 1
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuHasBeenSaved()

Unread post by admin »

toms,

OK, I've changed the way it works.

You can try it again.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: nuHasBeenSaved()

Unread post by toms »

Steven,

I don't see the change on Github.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuHasBeenSaved()

Unread post by admin »

toms,

This is it here...
git.PNG
Steven
You do not have the required permissions to view the files attached to this post.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: nuHasBeenSaved()

Unread post by toms »

Steven,

It still doesn't work for me.

It works if I change it to this (replace == 0 with >=0)

Code: Select all

	if(window.nuTimesSaved >= 0){	
		window.nuTimesSaved 	= -1;
	}
Tested use cases with correct results:

Action: Open Browse Screen.
[Result]: nuHasBeenSaved() returns -1

Action: Open Browse Screen, then select a record (opens Edit Screen)
[Result]: nuHasBeenSaved() returns 0

Action: Open Browse Screen, then select a record, save the record
Result: nuHasBeenSaved() returns -1

Action: Open Browse Screen, then select a record, save the record twice
Result: nuHasBeenSaved() returns 2

Action: Open Browse Screen, then select a record, save the record three times
Result: nuHasBeenSaved() returns 3

Action: Open Browse Screen, then select a record, save the record three times, return to the Browse screen
Result: nuHasBeenSaved() returns -1

Action: Add a new record, save it
Result: nuHasBeenSaved() returns 1

Action: Open a record, clone it
Result: nuHasBeenSaved() returns 0

Action: Open a record, refresh
Result: nuHasBeenSaved() returns 0
Last edited by Anonymous on Tue Aug 21, 2018 7:47 am, edited 4 times in total.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: nuHasBeenSaved()

Unread post by toms »

This case has yet to be dealt with:

If nuReturnNewRecord() is called in PHP (AS event)
nuHasBeenSaved() returns 1 instead of 0.

This is in contradiction with nuIsNewRecord() that correctly returns true
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuHasBeenSaved()

Unread post by admin »

toms,

Have a go now.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: nuHasBeenSaved()

Unread post by toms »

Steven,

It still doesn't work. (and I don't see any changes in the latest commit )
toms wrote:hmmm, nuHasBeenSaved() still returns 1 after a refresh.

1. Open a new or existing record
2. nuHasBeenSaved() returns 0
3. Refresh the record
2. nuHasBeenSaved() returns 1
But my suggested fix works for me (Aug 17, 2018)
toms wrote: It works if I change it to this (replace == 0 with >=0)

Code: Select all

	if(window.nuTimesSaved >= 0){	
		window.nuTimesSaved 	= -1;
	}
Post Reply