View Full Version : 2022 Field for Date
tim_newsome
2023-03-07, 02:44 PM
I have created a Date field.
It will not change from the date shown from first creating the field.
I have done the redraw.
Look into the FIELDEVAL variable, it controls when that field gets updated.
upon Open, upon Save, upon Regeneration etc
Ed Jobe
2023-03-07, 05:42 PM
You can also manually update it with the UPDATEFIELD command.
Tom Beauford
2023-03-08, 09:30 PM
UPDATEFIELD will not update Date fields, I use this lisp by lpseifert that updates All fields by saving "UpdateAllfields.lsp" in a Trusted Support folder & adding the macro: ^P(or C:UpdateAllfields (load "UpdateAllfields.lsp"));UpdateAllfields
; by lpseifert for updating date fields not updated automatically based on the setting of the FIELDEVAL system variable.
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/programmatically-update-a-date-field/m-p/2357937#M268137
; ^P(or C:UpdateAllfields (load "UpdateAllfields.lsp"));UpdateAllfields
(defun c:UpdateAllfields (/ ss1 sslen count)
(setq ss1
(ssget "x"
'(
(-4 . "<and")
(-4 . "<or")
(0 . "insert")
(0 . "*text")
(-4 . "or>")
(-4 . "and>")
)
)
sslen (sslength ss1)
count 0
)
(command "updatefield" ss1 "")
(while (< count sslen)
(entupd (ssname ss1 count))
(setq count (1+ count))
)
(princ)
; (command "regen")
)
Ed Jobe
2023-03-09, 12:19 AM
Hi Tom, UPDATEFIELD does update a DATE field. I just tested it. In fact, this lisp uses UPDATEFIELD to do the update. It just automates the entity selection. Manually running UPDATEFIELD prompts you to select the field. It's just that date fields, by design, are not automatically updated. Most people use them like a timestamp and it shouldn't change when you open/save a dwg.
Tom Beauford
2023-03-09, 12:01 PM
Hi Tom, UPDATEFIELD does update a DATE field. I just tested it. In fact, this lisp uses UPDATEFIELD to do the update. It just automates the entity selection. Manually running UPDATEFIELD prompts you to select the field. It's just that date fields, by design, are not automatically updated. Most people use them like a timestamp and it shouldn't change when you open/save a dwg.
Generally all our drawings include the SaveDate when the drawing was last updated and the date the survey work was completed saved in custom properties. Neither of them would be modified by UPDATEFIELD with or without the lisp. With the default value for FIELDEVAL all fields update themselves anytime they're needed.
While the lisp would update the Date field I'm thinking now what Tim should probably be using is the SaveDate field instead. I could see using the Date field and updating it one time when a new user takes over modifying the drawing or creates a new drawing from a template that has the Date field in it, maybe that's what Tim is doing. Odd that the date in the image he posted was the same as the date he posted it, maybe what he actually wanted was MM/dd/yyyy format instead?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.