Input today date if change

Creating a macro - Writing a Script - Using the API

Input today date if change

Postby msalsinha » Wed Nov 09, 2016 11:11 am

Hello

I wanted to create a function or a macro that whenever I modify a certain cell with a certain content it marks the date of today without coming back to update unless I change the contents of the cell again.

Can someone help me?
OpenOffice 4.1.3 on Windows
msalsinha
 
Posts: 5
Joined: Wed Oct 19, 2016 12:48 pm

Re: INPUT TODAY DATE IF CHANGE

Postby Zizi64 » Wed Nov 09, 2016 11:46 am

You can use a form control element for the value modification. In this case you can assign your timeStamp macro to the "click on" event of the form control element. Or you can create a listener (changed event) for the cell. Search the word "Listener" in the macro forum.

Note:
A click on the form control element not will always mean : "The cell content is changed", as the manual input (typing some data into a cell) not always mean : "The cell content is changed", because you maybe typed in same value as the cell was contained. But the event will activated, when you edit a cell. My opinion you need store the previous content of the examined cell (into a global macro variable) for the exact detecting of the change.
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.3.3; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8555
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: INPUT TODAY DATE IF CHANGE

Postby msalsinha » Wed Nov 09, 2016 1:36 pm

Let me demonstrate what exactly I try to do.

Whenever in the "ESTATE" column I change the state of each cell, in the "DATE" column will appear the date when the change was made.

Image
Attachments
EXAMPLE.ods
(9.47 KiB) Downloaded 75 times
OpenOffice 4.1.3 on Windows
msalsinha
 
Posts: 5
Joined: Wed Oct 19, 2016 12:48 pm

Re: Input today date if change

Postby Villeroy » Wed Nov 09, 2016 5:52 pm

menu:Tools>Options...OOoCalc>Calculate: Enable iteration with 1 step
Code: Select all   Expand viewCollapse view
=IF(A1="";"";IF(B1="";NOW();B1))
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27392
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Input today date if change

Postby Zizi64 » Wed Nov 09, 2016 9:31 pm

Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.3.3; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8555
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Input today date if change

Postby Zizi64 » Wed Nov 09, 2016 11:14 pm

A simple example with Combobox and macro:

DateTime of change.ods
(13.75 KiB) Downloaded 78 times
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.3.3; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8555
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Input today date if change

Postby Zizi64 » Wed Nov 09, 2016 11:28 pm

Modified example. The scope of the macro is limited to the cells have custom cell style, named "InputCells".

DateTime of change2.ods
(14.02 KiB) Downloaded 93 times
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.3.3; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8555
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests