Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
+1
person also asked this
people also asked this
Replies
9 replies
Subscribers
6 subscribers
Views
7214 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Process
#GeneratedValue How to get auto generated value in process model. In CDT, t
anilkumark
over 9 years ago
#GeneratedValue
How to get auto generated value in process model. In CDT, there is an auto generated ID, but in the instance it not showing the auto generated ID. How can I see this ID in my process model. Thanks.
OriginalPostID-155011
OriginalPostID-155011
Discussion posts and replies are publicly visible
0
GouthamKrishna
over 9 years ago
Hi, If you are speaking about @GeneratedValue annotation set on a column in cdt xsd, then an auto generated value is assigned for that column when a record is written to database. Can you be more specific on whether you want to see ID in a model or in a process ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
anilkumark
over 9 years ago
@Goutham.
How to get auto generated ID and how to update values for that particular ID.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
anilkumark
over 9 years ago
in the same process model.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
srirams761
A Score Level 2
over 9 years ago
HI Anil,
Please navigate to your CDT, download the XSD, open and edit it. Add the following @ annotation to make your column as auto generated :
<xsd:element name="idInt" type="xsd:int">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">
@GeneratedValue
</xsd:appinfo>
</xsd:annotation>
</xsd:element>.
Hope this is what you required.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 9 years ago
Based on your actual question I think you are using a CDT to insert into a table and want to pick up the auto-generated ID value? On the write to datastore node use the data output tab to save the "Stored Values" back into your CDT process variable, if your XSD is defined as mentioned above you will now have your id value.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
anilkumark
over 9 years ago
Thanks Tim. I have done same thing, but the values are not updating for same ID. It is creating one new ID. In my process model using two Write to Datastores. One for Insert and the other for Update. In Insert write to datastore node ID is generating. Now I need to update the values for that generated ID.
In Output at Stored Values passing CDT for Target field in both the Insert and Update write to data store nodes.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 9 years ago
And you have the @Id and @GeneratedValue annotations in your XSD definition of the CDT? Could you share your XSD or at least the primary Id element?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
anilkumark
over 9 years ago
xs:sequence>
<xs:element name="ORDR_SBMT_ID" type="xs:integer" nillable="false">
<xs:annotation>
<xs:appinfo source="appian.jpa">
@Id
@Column(name="ORDR_SBMT_ID" columnDefinition="NUMBER NOT NULL")
@SequenceGenerator(name="orggenerator", sequenceName="ORDR_SBMT_ID_SEQ", initialValue=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="orggenerator")
</xs:appinfo>
</xs:annotation>
</xs:element>
ID is generating, but how to get the auto generated ID? If I get the generated ID in process model, then I can pass the updated values to that ID.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sonalk
over 9 years ago
Hi Anilkumark,
Place a script task in between the two write to DB nodes and map the generated Id into a corresponding variable of the CDT.
Hope it helps.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel