cancel
Showing results for 
Search instead for 
Did you mean: 

How to get auto incremented ID value using MDO Query

Former Member
0 Kudos

Hi Friends,

I am using MDO Insert and Select Query in web page to display tree structure. I am having an ID column in the insert Query and I want to auto increment the ID column value on insertion of records in other correponding columns.

I am having 3 columns ID, NDE and PNDE in the MDO Object and the table looks something like below:

ID          NDE          PNDE

1           Root           ------

2           Energy        Root

3           Electrical     Energy

4           Fuel            Energy

5           LPG            Fuel

6           FO              Fuel

7           HSD           Fuel

Tree Structure:

Energy

     Electrical

     Fuel

           LPG

           FO

           HSD

I want that when a new record in NDE and PNDE columns are inserted then the corresponding ID value also must get auto incremented dynamically.

Can anyone help me on this?

Regards,

Shitikantha Nanda

Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi Nanda,

I am not sure whether MDO auto increment functionality available or not.

But a work around would be creating a MDO query with Select Mode.

First, ensure that Row Count property in General tab is limited to 1.

select query should be:

and the result would be:


I suggest that you create a transaction. In one leg, you can have the select MDO query where it will fetch the maximum ID value and assign it to a local variable.

Increment the local variable with +1 and then insert it to new record.


Regards,

Sai Vellanki.


Former Member
0 Kudos

Hi Sai Vellanki,

Thanks for the responce. The BLS concept actually worked.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Friends,

Any resolution to the above mentioned issue?

Kindly revert back ASAP.

Thanks in advance.

Regards,

Shitikantha Nanda