cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset value of a custom property of an MDO object?

manishagb
Explorer
0 Kudos

Hi,

I have an ID (custom attribute, numeric, key) in my MDO object.

Also, have set a custom property last_insert_id which i want to use as value for ID in the next INSERT operation to be performed on the same MDO.


In short.. in my transaction, using MDO, i am trying to achieve the functionality similar to auto-increment concept in SQL tables.

Highly appreciate all your valuable inputs on the same.

Thanks,

Manisha

Accepted Solutions (0)

Answers (3)

Answers (3)

swaroop_anasane
Active Contributor
0 Kudos

Also, I was wondering why custom properties for MDO object doesn't come up in the xml generated. For columns we can anyways get it as part of xml.

Any suggestions!!

Thanks,

Swaroop

manishagb
Explorer
0 Kudos

Hi Swaroop,

Yes, we can see the custom properties' info when the MDO is queried with mode "Info", as is referred in following sample URL :

http://xxx.xxx.xxx.xxx:0000/XMII/Illuminator?server=MDOConnector&Mode=Info&MDO=BMG/MIIOBJ/EmployeeMDO&content-type=text/…

This answers, from where/how to extract the custom properties of an MDO object, in a transaction.

Now, it is to be discovered whether we can reset them with some other value.

Regards,

Manisha

swaroop_anasane
Active Contributor
0 Kudos

That's fantastic!!! Thanks Manisha.

But ultimately, you cannot get the data as well as custom property for MDO together. I would still go with Partha's suggestion of using GUID for identity column.

Regards,
Swaroop

former_member193328
Active Participant
0 Kudos

Hi Manisha

I would second Swaroop's suggestion to read the ID and then increment it in the insert. However please understand that such an approach has severe drawbacks and also potential for failure.

For example assume 2 people execute the transaction in parallel and they simultaneously read the ID and then try to increment. One of them will surely end up with Primary Key Non Unique problem.

The way to avoid this would be to do a SELECT FOR UPDATE.

The best way to do this is not to use incremented ID as Key. Instead use GUID.

Regards

Partha

manishagb
Explorer
0 Kudos

Thanks so much for you replies, Swaroop/ Partha.


Yes, I could also think of the same approach and completely agree with the reason behind it.

But wanted to know if there is any direct way to implement it.


Also the main purpose of this query is to understand if we can consume/refer the MDO custom property in a transaction. And also, if it is possible to reset the custom property at the run-time.


Would be thankful, if somebody can provide some concrete info/link on this.


Regards,


Manisha

swaroop_anasane
Active Contributor
0 Kudos

Hi Manisha,

As far as I know, custom properties cannot be referenced from MDO Queries, so you would not be able to make use of custom properties in MDO Insert query to simulate auto-seed.

For such a case, you can use combination of select and insert MDO queries in BLS. You can get max value of ID and add 1 to seed it.

P.S. You get custom properties in xml results.

Hope this helps.

Warm Regards,

Swaroop