Skip to main content
Known Participant
Apr 3, 2024 3:19 PM UTC
Question

sql inner in appian

Hi,

"I have three lists and I need to obtain the values present in all three lists? How can I do this without having to perform an inner join on the database?"

ex. list1: {"IT","UK,"DZ", "USA"}

 list2: {"DZ", "USA"}

 list3: {"IT","UK,"DZ"}

and I need to obtain {"DZ"}

thanksss

9 replies

Known Participant
Apr 3, 2024 3:36 PM UTC

This code may help you 

a!localVariables(
local!list1: {"IT", "UK", "DZ", "USA"},
local!list2: {"DZ", "USA"},
local!list3: {"IT", "UK", "DZ"},

a!forEach(
items: local!list1,
expression: if(
and(contains(local!list2, fv!item), contains(local!list3, fv!item)),
fv!item,
{}
)
)
)

stefanhelzle0001
Brainy
Apr 3, 2024 4:26 PM UTC

Do you need/want to solve this in the database?

harshitb6843
Brainy
Apr 3, 2024 5:08 PM UTC

[View:https://docs.appian.com/suite/help/24.1/fnc_set_intersection.html:320:50]

shubhama926776
Brainy
Apr 3, 2024 5:45 PM UTC

Do you want to do this for VIEW definition in database?

शुभम्
davidj137213
Brainy
Apr 3, 2024 10:05 PM UTC

DO it in the database, merge the list in SAIL or use records.....

karumurua531442
Participating Frequently
Apr 4, 2024 3:06 AM UTC

hi [mention:cdbe3381ad184204981f46f0aec54d80:e9ed411860ed4f2ba0265705b8793d05] instead of doing that in database it will be easy to do it in appian side using   intersection() this function will help you click on the link for more details of that function

Participating Frequently
Apr 4, 2024 3:44 AM UTC

By writing a query first get that three lists to Appian environment from Database then write this expression,

a!localVariables(
local!list1: {"IT", "UK", "DZ", "USA"},
local!list2: {"DZ", "USA"},
local!list3: {"IT", "UK", "DZ"},

intersection(local!list1,local!list2,local!list3)
)

srmm0001
Inspiring
Apr 6, 2024 12:00 PM UTC


list1: {"IT", "UK", "DZ", "USA"},
list2: {"DZ", "USA"},
list3: {"IT", "UK", "DZ"}


commonValues = intersection(list1, list2, list3);

---> commonValues' will contain {"DZ"} as it is the common element 

jayaprakashr0001
Participating Frequently
Apr 8, 2024 5:07 AM UTC

Hi [mention:cdbe3381ad184204981f46f0aec54d80:e9ed411860ed4f2ba0265705b8793d05] ,

The below code might help you

a!localVariables(
  local!list1: {"IT", "UK", "DZ", "USA"},
  local!list2: {"DZ", "USA"},
  local!list3: {"IT", "UK", "DZ"},
  local!intersection1:intersection(local!list1,local!list2),
  local!intersection2:intersection(local!intersection1,local!list3),
  local!intersection2
)