Tried to find some similar topics, but couldn’t find a proper solution.
I’m trying to import data from a Excel-file that has been partially exported from Revit before. That part I understand, got a simple script for that.
The last columns (J to O) are filled with information from consultants. All seems to work fine, except for the fact that same cells can contain a date. Excel then automatically changes the cell notation from standard to date. When this value is imported in the parameter, it looks like the values from the watch node on the right: MM/DD/YYYY hh:mm:ss. What I’m trying to achieve is the following notation: DD-MM-YYYY. So: 31-12-2016 or 01-01-2017 in this instance.
Is there some workaround available, or is this the best solution I can get? I’m not that much into Python to make my own script, so a little advice would be appreciated.
It took some time for me to respond, but thanks for sharing your opinions!
@Kulkul I’ll give it a go, but I’ll need some additional filtering: not all cells contain a date, it might also be a text (string). Also, I’ll have to flip the day and month from MM/DD to DD/MM. Most simple hack for the time being: Use an apostrophe before the date in the cell. Using this still gives a clean notation in Excel, but prevents it to read that cell as a date.
I checked the system setting, and it’s set the way how I want it to appear: dd-MM-yy.
Also set read as strings to true, the only difference I notice is in the first watch-node (see my first post), the result is the same as when the output flows through the “string from object” node. If I try to import the value as a date, the Element.SetParameterByName node turns yellow:
Warning: Element.SetParameterByName operation failed.
The best overloaded method match for ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, double)’ has some invalid arguments
My best guess: Dynamo doesn’t use (or can’t use) the system setting for date and time.
@Vikram_Subbaiah When I copy the code I get the following warning:
Warning: No function called Components on a System.DateTime that takes DateTime could be found
or
Warning: Multiple definitions for ‘DateTime’ are found as DSCore.DateTime, Analyze.Render.DateTime, System.DateTime
Multiple definitions for ‘DateTime’ are found as DSCore.DateTime, Analyze.Render.DateTime, System.DateTime
Multiple definitions for ‘DateTime’ are found as DSCore.DateTime, Analyze.Render.DateTime, System.DateTime
I’m using the most recent version of Dynamo (1.2.1.3083) and Revit (2017.1)