Saving data in document
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/07/2005 at 02:38, xxxxxxxx wrote:
Thank you for your time and knowledge, Robert.
Lets say I have been providede with ID 123456789 for the plug-in. Would I be able to use the same number for the added ID to the document Base Container?
Oh, and what I want to add is a list of objects (actually, several lists of objects). Can I store an array in a single ID? Or do I need an ID for each element?!?Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/07/2005 at 07:32, xxxxxxxx wrote:
It is allowed to store plugin data in the documents BaseContainer, you must use a plugin ID and then store your data in a subcontainer or just use plugin IDs for each element (but a subcontainer is better if storing many values otherwise you are eating up lots of plugin IDs!).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/07/2005 at 07:43, xxxxxxxx wrote:
Thank you for your answer, David.
How can I create such a subcontainer?Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/07/2005 at 08:07, xxxxxxxx wrote:
Sorry, no idea about COFFEE. Its just a BaseContainer, in C++ its just SetContainer() and you pass in your BaseContainer with your settings.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/07/2005 at 09:25, xxxxxxxx wrote:
BaseContainers can't store arrays or lists, only single elements. You could try creating your own CustomDataType. Or, set one of the BaseContainer elements to the number of objects and add each element using IDs starting from a predetermined value. For example:
ID_MYCONTAINER_ID /Plugin ID/
ID_MYCONTAINER_COUNT 999 // LONG
ID_MYCONTAINER_START 1000 // First element IDThen you'll loop inside your plugin (when available) to get the elements (after getting your subcontainer 'bc') :
LONG count = bc->GetData(ID_MYCONTAINER_COUNT); // Allocate a storage array if needed Here for(LONG x = 0; x < count; x++) { array[x] = bc->GetData(ID_MYCONTAINER_START+i) }
And David has it correct. If you store in the top level container, you'll need unique IDs for each element. So store your BaseContainer in the top level BaseContainer of the BaseDocument and you only need a unique ID for your BaseContainer. The data that you store in your BaseContainer can have any IDs that you want.
It looks like you need to use SetData(id, data) to add the subcontainer to the BaseContainer.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/07/2005 at 01:29, xxxxxxxx wrote:
Storing a sub-container in C.O.F.F.E.E. is as simple as storing anything else. Just create a subbc = new(BaseContainer) and then use bc->SetData(ID, subbc) to set and bc->GetContainer() to retrieve it.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/07/2005 at 07:44, xxxxxxxx wrote:
We're using the BaseDocuments container to store data to the project, it is safe as long you write the data to IDs of the Plugin-Area, we use the IDs of our plugins to store data.
I think a customdatatype will not help you much, you will run into the same problem. If you want to store a list, the most simple approach is to make a container for it, define a LONG in which you store the number of entries of the list and a ID where the first list element starts in the container. Its easy to make even more complicated structures. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/07/2005 at 08:42, xxxxxxxx wrote:
Isn't that exactly what I detailed above?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/07/2005 at 10:04, xxxxxxxx wrote:
I just wanted to add that all you need to do is to create a subcontainer and store all your values within this one. Additionally use the first value to store the value count. Then you can simply store the subcontainer in the documents container with a plugin id from plugincafe...wait, i fell like repeating. 8-D
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/08/2005 at 13:30, xxxxxxxx wrote:
Is there anybody with a codesnippet that simply works?
Counting the "you only have to" and "its that simple" in this thread is impressing.
Only within the sdk examples set-or getcontainer is not included and i am confused by the sdk-documentation:"SetContainer(LONG id, const BaseContainer& s)
Sets the sub-container with the specified ID to s, or inserts it if it didnt exist."Tried this but it did not work as expected.
any help?Peter