Skip to main content
April 3, 2024
Question

sql inner in appian

  • April 3, 2024
  • 9 replies
  • 0 views

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

April 3, 2024

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
April 3, 2024

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

harshitb6843
April 3, 2024

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

shubhama926776
April 3, 2024

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

davidj137213
April 3, 2024

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

karumurua531442
April 4, 2024

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

April 4, 2024

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
April 6, 2024


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
April 8, 2024

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
)