Forum

Turning a list into...
 
Notifications
Clear all

Turning a list into a text string by every 1000 rows

3 Posts
3 Users
0 Reactions
538 Views
(@awoods8005)
Posts: 1
New Member
Topic starter
 

I am looking to convert a List in Power Query into a text string but divide it up by every 1000 items.
The List is a list of ID numbers that I am sending back to Oracle database, which has a 1000 item limit in the WHERE clause. Creating a temp table in Oracle is not an option.

So far, this is what I have.

let
Source = IDLIST,
IDLISTV2= "'"&Text.Combine(List.Distinct(Source[ID]),"','")&"'"
in
IDLISTV2

This returns all of the values of the list in one big text string, which is helpful, but wont work for what I am doing.

Assuming I had 3046 ID numbers, it would return
'ID1', 'ID2', ....., 'ID3045', 'ID3046'

I am looking for it to return
'ID1', 'ID2', .....'ID999', 'ID1000'
AND 'ID1001', 'ID1002',.....
...
...
AND ..... 'ID3045', 'ID3046'

It is essentially the same, but divided by every 1000. There needs to be a word or divider between every 1000 for Oracle to read it properly.
I thought about using some sort of loop command or maybe a mod function but dont have enough M or Power Query knowledge to know if they are viable options.

I have only been using M/Power Query in Excel for a couple of weeks now. I am very new to it and welcome any and all feedback.
If anyone knows anything that could help with this please let me know.
Thanks!

 
Posted : 28/03/2020 6:35 pm
(@gue19)
Posts: 8
Active Member
(@mynda)
Posts: 4761
Member Admin
 

Hi Austin,

Welcome to our forum. Please note that it is polite forum etiquette to be transparent when you post the same question on multiple forums so that those helping you know that they may be wasting their time.

@Guenter, thanks for sharing the cross post link, which I see has been answered.

Mynda 

 
Posted : 31/03/2020 12:21 am
Share: