Execute SQL with alias column names

  • 16 August 2018
  • 1 reply
  • 12 views

Badge +1

Hi, quick question regarding Execute SQL. My query contains an additional verification from the same column, so I'm using alias name:

select (some columns),

case when ad1.address IS NULL

then ad4.address 
else ad1.address
end adress,
case when ad1.address IS NULL then ad4.zip
else ad1.zip
end zip

from customer cu
left outer join address ad1 on cu_number = ad1.customer and ad1.type = 1 and ad1.expire_date is null
left outer join address ad4 on cu_number = ad4.customer and ad4.type = 4 and ad4.expire_date is null

where = (item property)

group by (all related columns from the select)

For each column, I'm storing the outcome with different collection operations (Collection variable to Text variable) on the same index, but the workflow returns the following error: "Error operating on collection variable. Index property is greater than the number of items in the collection."

The SQL works perfectly without the extra alias (ad4) so I'm guessing it has something to do with it. I have tried different solutions without any luck. How do a beginner like me solve this issue?

Br,

Asbjørn Nielsen


1 reply

Badge +1
Hi again, just wanted to update this post with how I solved it. Instead of having the select statement in one "Execute SQL", I inserted a "Run parallel actions" and divided the statement into two different "Execute SQL". Br, Asbjørn Nielsen

Reply