# Problem while inserting items into list

Hello,

i was trying to insert null items into a list at certain indices. However, some of these indices are higher than the list length and an overflow was occurring. Is there any way that I can modify the list to get the value at the specified indices without changing the original values in the list?

cheers

forum querry.gh (18.8 KB)

You can use “Replace Items” instead, but as you can see , there’s no index 652 in your original list…

thanks for your reply,

yes, i tried doing that as well. but the problem is that, i need to generate that empty entry at 652 even though it doesnt exist in the original list. thats what i had difficulty in doing. And i didnt find any alternative to creating those extra ‘null’ indices either. In this case its just 1, but there could be more when my geometry changes.

cheers

Something like this?

forum querry_re.gh (23.5 KB)

not really, I wanted a list like this

where all the indices of points are replaced by null values.

however, i just realised that my problem is more complicated than the question that i’ve originally asked.

i actually need this new list containing null values to sort another list according to certain indices.

Though i think i need to start a new thread for that

thanks a lot for your help anyway, much appreciated

new_querry.gh (10.0 KB)

Personally I expected this component to work in the following way:

SetA = {U, V, W, X, Y, Z} ,
SetB = {1, 2, 3}
Imap = {2}

>>Result = {U, V, 1, 2, 3, W, X, Y, Z}

That would be Insert List instead of Insert Items. Absolutely a useful operation to have as well.

To mimic that behaviour you’ll need:

A = \hspace{5mm} \{U, V, W, X, Y, Z\}
B = \hspace{5mm} \{1, 2, 3\}
map = \{2, 2, 2\}

thanks a lot david

I also got more from this thread here:

http://www.grasshopper3d.com/forum/topics/list-insert-problem?id=2985220%3ATopic%3A92380&page=2#comments