Create list of Queue Item Reference

Hi,

I want to create a list o Queue Items Reference.
I download all Queue Items to variable “IEnumerable”. Next I loop through it and add one by one Reference to list.

I wonder is there a quicker way to obtain a list without iteration.

Hi @mateusz.wojcik

You can use this Queeuitems.AsEnumerable.Select(function(row) row.Reference).CopytoDatatable use it in assign with the datatable

Cheers

yourStringList = YourQueueItemsOutVar.Select(Function (x) x.Reference).toList
yourStringList = YourQueueItemsOutVar.Select(Function (x) x.Reference.Replace("Machines_","")).toList
1 Like

Thanks it works !!!

I got error when I try to use your solution

Hi @mateusz.wojcik

The error says QueueItems variable is not found. You have tro use the output of get queue items in place of Queueitems

I guess the spelling of Queue is wrong your variable is Queueitems i Believe but here it is QueeuItems

cheers

I am sorry I upload wring screen.
Please see on the screen below.
Error message: copytodatatable’ is not a member of 'system.collections.generic.ienumerable

for a quick clearing:
the LINQ Code has some irregularities itself but is also not matching your case of working with an output from a Get Queue Items. Therefore the different validation messages are coming from.

Hi @mateusz.wojcik

Use it like this instead

first drag assign and add this to a string variable String.Join(Environment.NewLine,queu.Select(function(row) row.Reference))

Then pass this to Generate datatable. Use csv parsing check box or give line separator as Environment.Newline and column separator as , and you are done

cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.