Column to store 100 Phone Numbers

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

TargetID (num) OrderID (num) Targets(varchar)
1 1 +91-9999999999
+91-9999999999
+91-8888888888
2 1 +91-9999999999
+91-9999999999
+91-8888888888
+91-5555555555

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

TargetID OrderID
1 1
2 1

id TargetID Targets
1 1 +91-9999999999
2 1 +91-9999999999
3 1 +91-8888888888
4 2 +91-9999999999
5 2 +91-9999999999
6 2 +91-8888888888
7 2 +91-5555555555

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

Parents
  • 0
    Certified Lead Developer

    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 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'(

    targetID:" ",

    'orderID': 1,

    '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" )

    }

    'searchDate': fn!datetime(2023, 2, 18, 0, 0, 0, 0)

    )

    }

  • 0
    Certified Lead Developer
    in reply to GauravSingh

    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.

  • 0
    Certified Lead Developer
    in reply to GauravSingh

    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.

Reply
  • 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.

Children