Hi Experts,
I have a requirement where I need to store 100 phone numbers in a given field, i.e Targets for now. And then to filter the data on all the columns considering if user searches with 555 then 2nd record should be returned
Currently I was using a single table with structure as shown below
Now, due to some performance issues, we need to get that targets column to be moved to a separate table and store all the phone numbers as a separate row, as shown in below tables
Kindly suggest as how this can be implement, do we need to use nested CDT or if there is any other way possible.
Thanks,
Gaurav Singh
Discussion posts and replies are publicly visible
If there is no further use case other than just ability to search. You may save multiple phone numbers separated by ";" in single text field in DB and retrieve them and split them using the split(). Use contains operator to search the desired substring.
filter: a!queryFilter( field: "phone", operator: "includes", value: ri!value )
This is a good idea. Do not store multiple values in a single field.
For the design of the data model, I suggest to follow these guidelines
docs.appian.com/.../data-modeling-with-appian-records.html
Hi Abhay,
I'm foreseeing the challenge of Query timeout in Production that may arise if the data count gets increased at a subsequent period of time. Currently we are storing the data with ";" separated values in the same column.
During design review with Appian team , they asked to put it in a separate column with one row for each targets.The only challenge I'm facing is getting this implemented using the nested cdt, where TargetID is yet not generated when we are entering the multiple numbers.
Hi Stefan,Thanks for your response, The above guideline will lead us to redesign the whole process.
Currently we are using the CDT for target with below structure.
{ 'type!{urn:com:appian:types:TEST}TEST_Target'(
targetID:" ",
'orderID': 1,
'targets': "123;3422;23443",
'searchDate': fn!datetime(2023, 2, 18, 0, 0, 0, 0)
)}How can we redesign this so that 'targets' column could be array of cdt itself like as shown below.
{
'type!{urn:com:appian:types:TEST}TEST_Target'(
'targets': {
'type!{urn:com:appian:types:TEST}Test_RelatedTargets'( targetID:' ', 'Target': "123" ),
'type!{urn:com:appian:types:TEST}Test_RelatedTargets'( targetID:' ', 'Target': "3422" ),
'type!{urn:com:appian:types:TEST}Test_RelatedTargets'( targetID:' ', 'Target': "23443" )
}
)
Appian Records do not support nesting. Create two separate records and relate them.
For relating two records I think we might have to use the Sync Enabled record, which have its own issue with data availability on a immediate basis.
Is this possible to get this implemented with Nested CDT ?,
If yes then how can we map the targetID of the TEST_Target to targetID of the Test_RelatedTargets so that during write2DataStoreEntity the generated ids gets mapped to the nested cdt.
Out of curiosity, what do you mean with "own issue with data availability on a immediate basis"?
So, nested CDTs in a datastore will manage that automatically, if you set up the nesting relationship correctly. Just create the fields in the parent and child CDTs as required and for targets, select the child CDT data type as a list. Appian will then add the required fields and/or tables to manage that relationship.
With "own issue with data availability on a immediate basis" I mean the record will not be updated immediately until the Record get synced. And we cant sync the record every time we run the process.
User will keep on seeing the un-updated data for the time until record get synced.I have done the implementation as shown below, Though I have used one 2 many relationship in the nested cdt, the data is not getting populated in the DB as expected.
Test_RelatedTarget CDT
TEST_Target CDT
where mapping is as below
The way I'm framing the cdt on the UI is As shown below,
But when we are writing the data in DB, all the targets are getting clubbed into 1 column itself.
Hi,
I see an issue with your nesting configuration. The DB column is not matching the name that you provided in nested configuration.
Try with this configuration
hopefully this will work for you
You mentioned that the data doesn't show until it gets synced, but as long as you are updating data through nodes like Write to Data Store Entity or Write Records, those nodes also immediately sync the data.