Dates extracted from Revit to Dynamo in Random format

Hello All,

I’ve been stuck into this thing for weeks.

Refer to the image,
Date1 corresponds to date in front of revision p00 above and similarly for all. (Highlighted in green)

As you can see in the excel the extracted dates have 2 types of formats, where at one place it seems Text hence DDMMYY, and at some places it is taking MMDDYYYY date format, randomly. Whereas in revit title block you can see it is DDMMYY only.

Can anyone please help me to figure out the issue here.
All I want is that everything get extracted as DDMMYY, text.

Thank you.
Regards,
Atharva Purohit.

Have you tried pre-formatting the cells in excel to date in DDMMYY format? Otherwise excel will just guess which format is correct.

2 Likes

If I ever found this issue I used to put a ~ in front of the text, fix the format in Excel to text and then find and replace the ~ after. Excel is as dumb as a bag of bricks sometimes with that stuff.

4 Likes

Hi Leo,
Thanks for responding, but looks like this isn’t working.
Since revit by default throws MMDDYYYY format only, whereas then in my case DD will MM and MM will be DD
and if I convert it to DDMMYY, it wont be correct.

Hello Aussie Guru!
Thanks for replying, but i’m afraid it will be a manual approach to it, which my manager wont be accepting :stuck_out_tongue:

Regards,

Hmm and what about simply using string? So that it is not in a date format but just plain string?

1 Like

Four options:

  1. Use a ’ (single quote) prefix to force Excel to keep the data as a string.
  2. Use another format (Excel is the worst with forced formatting).
  3. Use a template excel file with the formatting locked in on sheet 2 with sheet 1 just having the data.
  4. Accept a slight post processing step.
1 Like

Hi Jacob and Leo,

Thanks for responding!
@jacob.small I’ll also try out these, and check their feasibility.

I came up with another approach, where i’m trying to replace the problematic dates with forced strings in dynamo itself.
Came up with the following code -

Though it is working for me in Google Collab but not here in dynamo.

image

Any thoughts/solution/modification to tailor it to dynamo?
By python or ootb only.

L1 = [[None, 2, None], [3, None, 4], [None, 5, None]]
L2 = [[‘a’, ‘b’], [‘c’], [‘e’, ‘f’]]
L3 =

for i, sublist in enumerate(L1):
new_sublist =
for j, item in enumerate(sublist):
if item is None:
new_sublist.append(L2[i].pop(0))
else:
new_sublist.append(item)
L3.append(new_sublist)

print(L3)

Thank you.

Regards,
Atharva Purohit

I can’t tell what you’re after anymore - which dates are problematic? Where are they coming from?

We need a graph and a dataset to help at this point. This doesn’t not necessarily mean we need your project, but a condition which reproduces your issue as random strings aren’t the same, as you’ve noticed already.

1st method of single quote worked!
I concatenated ’ before all the dates.

Thank you Jacob!

Regards,
ap

1 Like