Setting a field in extensible storage removes the other fields from the entity

Thanks to everyone who’s put up with my deluge of posts about this over the past week. I really do appreciate all the help. :slight_smile:

I’m trying to write a series of information for issuing sheets…
So issue 1 may be one week, issue 2 a week later… and so on.

I want to store the previous issued information and @jacob.small suggested extensible storage… It seemed like a good idea…

Anyways… I decided to use the string fields (I like simple) but I’ve run into yet another snag.

If I set my first field, “I love moose” then attach it to my DB element.
I can read this field.

However, if I go to write another field at a later date and set it to my element it removes the first field from my element.

I can write multiple entities to the DB element in one go (but obviously this is no use to me).

Do I have to read the fields attached to the element… then add to the end and write ALL the fields?

Eg, do I have to re-write the existing fields at the same time as adding a new one.

OR is there a better type of schema for this kind of thing?

TL:DR What’s the best way to get my element to store fields written at different times?
image

When building your field, are you adding it as a simple field?

If so why aren’t you using an array field?

Once you’re doing that you should be able to grab the entity (stored on a the data element or perhaps a sheet itself), extract the array, add
The new value to the end of the array, and then set the value of the field to the updated array.

1 Like

All the examples were simple fields so that’s what I followed…
I didn’t know they had different write properties.

Are you saying with an array the first field won’t get over written when I update another field?

If you have an array you have one field with your data in it…

1 Like

It works only IF I get the existing field values then add to them each time.

I’d have thought once the field exists I can just add to it without getting it and setting it again…

The fact stuff can be so easily deleted is really worrying. :frowning:

I’d prefer something that was fixed once I’d set it.

So what you are saying is that it works the same way that ALL data storage does?

If you save over a text document called ‘moose.txt’ which contained your favorite moose documentaries with a new list of texts showing your favorite moose related comedy movies the previous one is lost.
If instead you have an excel file with your favorite moose documentaries and you write “monty python and the holy grail” in the value of A1, the previous value is overwritten.
If you set the parameter “name of moose” on the desk to be “Harold”, the previous value of “johny” is lost.
If in your python you define your list of numbers as myList = [1,2,3] and then change it to myList = [10,11,12] you can’t get [1,2,3] back.

It sounds like what you want is an “append to array” method, which you could write as a custom definition.

And yes, such a definition would be easier in C# than Python. *nudge*

I’m saying you have to get the thing before you can add… you can’t just add… And it’s too easy to overwrite the whole thing (rather than just adding)…

It’d be nice if you could write to the field, but not overwrite anything there.

As for C# … Pretty sure it’d be harder as my level of C# is about as good as my (insert something I’m awful at).

1 Like

It’s designed like a parameter. If you want the value for ‘comments’ to go from “Confirm finish with owner in field before purchasing.” to “Confirm finish with owner in field before purchasing. Validate VOC compound with manufacturer.”, then you have read, append, and then write.

1 Like

It seems I can add two separate schemas to one object… Am I imagining this/ is it a glitch in my Revit… or can you actually attach multiple schemas to an object?

Yes - you can load multiple schemas onto an element.

Imagine if developer A wants to track the occupant load using an egress element by putting their schema on the object, and developer B wants to track the formula applied for the expected number of uses per day using their schema on the object, both need to be enabled.

2 Likes