Skip to main content
March 17, 2023
Question

Relate Data from two unrelated tables.

  • March 17, 2023
  • 10 replies
  • 0 views

Hi,

Please let me know the solution for this, with proper justification.

You have data from two unrelated tables. Which Appian objects can easily relate data from these two tables?

a)custom data type

b)Expression rules

c)Record Types

d)process models

10 replies

March 17, 2023

What is your use case please give us some more info.

March 17, 2023

Hi Ujjwal,

I have two tables, example -- customer table and  employee table , I want to relate these , with no common relationship. how to do that?

Using CDT or Records?

March 17, 2023

Relationships are based on columns in each table that contain the same data. For example, you could relate a Customers table with an Orders table if each contains a column that stores a Customer ID

adityag9712
March 17, 2023

HI, Here you can use CDT.

 

Then create a new expression. 

a!localVariables(
  local!table1: { { column1: 1, column2: 2 } },
  local!table2: {
    { column1: 1, column2: "King" },
    { column1: 1, column2: "Queen" },
    { column1: 2, column2: "Queen" }
  },
  a!forEach(
    index(
      local!table2,
      wherecontains(
        local!table1.column1,
        local!table2.column1
      ),
      {}
    ),
    'type!{urn:com:appian:types:AC}AC_testCdt'(
      table1column1: local!table1.column1,
      table1column2: local!table1.column2,
      table2column1: fv!item.column1,
      table2olumn2: fv!item.column2
    )
  )
)

March 17, 2023

Can't we use record for relating two unrelated tables? If no, why?

adityag9712
March 17, 2023

Yes, we can use in the same way.

March 17, 2023

Hi Kirang

In the latest version of Appian using Record Types for relationship are the recommended method for connecting different data sources or different tables

This can also be achieved by -

1) Creating a view in DB with the tables required and then making a CDT of the view.

2) (Least Preferred) Having tables joined by foreign key and then creating nested CDT to access data of the linked table via main table

Please flag the question as answered as it can help other people.

Amitesh Singh

March 17, 2023
Creating a view in DB with the tables required and then making a CDT of the view.

Is it possible to have a view with no common field defined in both the tables? How will we create the view on totally non related tables.

for point number 2, how do we connect two unrelated tables?

What exactly is the answer of above question.

Is it CDT or Record Types or expression rules?

adityag9712
March 17, 2023

Expression rule