Skip to main content
Known Participant
July 15, 2024
Question

How to query Record Type by Comparing Record Type field and Relationship field?

Hi,

Could you please help me with the below requirement

Sample Table and Data

RequestTable

id name       email                 createdOn            createdBy
1    N1   n1@mail.com 2020-07-27 13:15:30 n1@mail.com
2    N2   n2@mail.com 2020-07-27 13:15:30 n2@mail.com
3    N3   n3@mail.com 2020-07-27 13:15:30 n3@mail.com
4    N4   n4@mail.com 2020-07-27 13:15:30 n4@mail.com
2    N5   n5@mail.com 2020-07-27 13:15:30 n5@mail.com

Conversation:

id  reqId    message       sentBy
1    1            Xyz         n1@mail.com
2    1            abc         reviewer1@mail.com
3    1            pqr          admin@mail.com
4    2            xxx          reviewer2@mail.com
5    2            yyy          n2@mail.com
6    2            zzz          n2@mail.com

I want to get the Conversations which are not sentBy the same user of that particular request

Below is the SQL query:

SELECT b.* FROM RequestTable a join  Conversation  b on(a.id=b.reqId) where a.createdBy<>b.sentBy and a.id=1;

Output:

id  reqId    message       sentBy
2    1            abc         reviewer1@mail.com
3    1            pqr          admin@mail.com

I wanted to know how to achieve it in Appian using Record Types

Thanks

2 replies

sriramk5349
Inspiring
July 15, 2024

Hi [mention:863e5dee5cf148d0961cf1608a7e6158:e9ed411860ed4f2ba0265705b8793d05] ,

you can use relatedRecordData parameter in a!queryRecordType() Function - Appian 24.2. 

Known Participant
July 15, 2024

Hi [mention:e3625867b9174cde8adf66b9ab725141:e9ed411860ed4f2ba0265705b8793d05] ,

Thanks for Reply.

I know we can use related record fields for filtering.

But the problem here is

we have to use value as Record field.

SELECT b.* FROM RequestTable a join  Conversation  b on(a.id=b.reqId) where a.createdBy<>b.sentBy and a.id=1;

In the above query we have to use record fields both sides (  a.createdBy<>b.sentBy ).

As I tried there is option to provide record field as value in filter