Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Number of days between today and a past date (Read 1694 times)
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
Number of days between today and a past date
Oct 28th, 2005 at 1:48am
Print Post Print Post  
I can program the number of days between today and a date in an element of the form and put it into another element.
But this will calculate only when I click on the element and just does it for that particular record.
What I want is a program that calculates the above number of days for every record in the database each time I enter the database in search mode and puts the answers in the corresponding elements of each and every record.
  
Back to top
 
IP Logged
 
Blair Wettlaufer
Junior Member
Members
**
Offline


No personal text

Posts: 98
Location: Hamilton, ON
Joined: Jun 4th, 2005
Re: Number of days between today and a past date
Reply #1 - Oct 28th, 2005 at 3:45am
Print Post Print Post  
Sounds like you would have to do a mass update ... maybe have one run on application start-up?  Would that work for you?
  

Coesper erat: tunc lubriciles altravia circum&&Urgebant gyros gimbiculosque tophi:&&Moestenui visae borogovides ire meatu:&&Et profugi gemitus exgrabuere rathae
Back to top
 
IP Logged
 
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
Re: Number of days between today and a past date
Reply #2 - Oct 28th, 2005 at 12:06pm
Print Post Print Post  
Sounds interesting.
Can I do an automatic mass update each time the application starts?
How would I program that?
Eduardo
  
Back to top
 
IP Logged
 
Blair Wettlaufer
Junior Member
Members
**
Offline


No personal text

Posts: 98
Location: Hamilton, ON
Joined: Jun 4th, 2005
Re: Number of days between today and a past date
Reply #3 - Oct 28th, 2005 at 2:30pm
Print Post Print Post  
With the select tree commands, I'd believe.
  

Coesper erat: tunc lubriciles altravia circum&&Urgebant gyros gimbiculosque tophi:&&Moestenui visae borogovides ire meatu:&&Et profugi gemitus exgrabuere rathae
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Number of days between today and a past date
Reply #4 - Oct 29th, 2005 at 3:33pm
Print Post Print Post  
I dont think you want to spend the time needed to run a mass update each time you open the database. There are several other options to do what you want, but you may want to consider:

On Form Entry, have the number of days calculated. This way, the 'math' is only performed when you are viewing that record. (it happens instantly).

Also, if you arent using that LE in searches or in xlookups, you can free up some 'overhead' in your database by making that LE 'unbound'. Your 'math' will still be performed, and visible in the LE, but it wont be saved to database each time you close the form....thereby keeping your database as efficient as possible. (If you prefer for that LE available for searches or lookups, then you should leave it 'bound'.)

ALso, if you only wanting this LE for 'searches', you should not try to 'maintain' the 'number of days' LE field, just use a programmed retrieve in the date field. You can even get fancy with the @promptforuserinput in the 'On Retrieve spec open' slot. THis will ask the user how many days they are looking for, and will use the response in the programmed retrieve.

Tell us how it goes.

Steve
  
Back to top
IP Logged
 
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
Re: Number of days between today and a past date
Reply #5 - Oct 31st, 2005 at 4:21pm
Print Post Print Post  
I did the programming On Form Entry and it works very nice.
However, when I try to leave the search/update, it tells me that the record has not been saved.
Is there a way to save the record with out entering another one?
In other words, is there a way to save a record without pressing F10?
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Number of days between today and a past date
Reply #6 - Oct 31st, 2005 at 4:50pm
Print Post Print Post  
On the Menu Tree under the Navigation Folder is a Save Record Choice.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Number of days between today and a past date
Reply #7 - Oct 31st, 2005 at 4:56pm
Print Post Print Post  
Ray, Isnt this issue ("Prompt to save" when an unbound LE is changed) a bug that has been fixed in 1.1.3?

I know we've been putting up with it for a while thinking that the fix was just around the corner. If it's not a bug, then I need to come up with a workaround on my end.

Thanks,
Steve
  
Back to top
IP Logged
 
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
Re: Number of days between today and a past date
Reply #8 - Oct 31st, 2005 at 5:11pm
Print Post Print Post  
Thanks.
There is also a convenient Shift F10 that saves and closes.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Number of days between today and a past date
Reply #9 - Oct 31st, 2005 at 5:29pm
Print Post Print Post  
Quote:
Ray, Isnt this issue ("Prompt to save" when an unbound LE is changed) a bug that has been fixed in 1.1.3?

I know we've been putting up with it for a while thinking that the fix was just around the corner. If it's not a bug, then I need to come up with a workaround on my end.

Thanks,
Steve



Hello Steve,

Yes, with certain unbound elements. If I rememebr right some did not do it while others did. but yes 1.1.3 has several "This record has been changed" fixes.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
etejeira
Junior Member
**
Offline


No personal text

Posts: 60
Joined: Aug 6th, 2005
Re: Number of days between today and a past date
Reply #10 - Nov 1st, 2005 at 4:26pm
Print Post Print Post  
Ray, I have noticed that the Save Record command on the Menu Tree under the Navigation Folder is not working.
The only way I can save a record after the programmed On Form Entry is using the Shift-F10 command which takes me out.
I believe this is a bug.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Number of days between today and a past date
Reply #11 - Nov 1st, 2005 at 4:42pm
Print Post Print Post  
Hello Etejeira,

I just looked at this and here is what is happening. When you click the Save Record command on the menu tree it saves the current record and then reloads it. When it reloads it the on Form entry programming fires. In your application this is changing the record again by setting the number of days.

You can prevent the "Record has been changed" message by putting an If statement in your On Form Entry programming that does not set the value of the days element if it is already set to the value that the programming would set it to anyways.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Number of days between today and a past date
Reply #12 - Nov 1st, 2005 at 4:59pm
Print Post Print Post  
Ray,

THANK YOU for pointing out that Sesame 'reloads' the form after saving. This may explain a LOT of my issues (I had been saving a record in the middle of some extensive programming such as @createnewrecord, @formfieldvalue, etc.)

I'll take a closer look at my "On Form Entry" programming now.

Is there a way to save without reloading the form?

Thank you, again!

Steve
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Number of days between today and a past date
Reply #13 - Nov 1st, 2005 at 5:12pm
Print Post Print Post  
Steve,

I believe FormCommit() will save the current record but not reload it.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Number of days between today and a past date
Reply #14 - Nov 1st, 2005 at 5:18pm
Print Post Print Post  
Ray - Thanks!

Etejeira - I have this program in a command button that saves changes and advances to the next record:

var nn as int

nn = @selecttreeitem("Add data menu!Navigation!Advance Record (F10)")

Just FYI.

Steve
  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print