How to read variables into a list without using append

Hi everyone,

I am having an issue with the list function. I am running a for loop that reads data from 11 variables into a list and then appends that list into a table. But i can not figure out how to make the list work as appends only adds new elements and I need to override the same 11 elements within the list every time the for loop resets.

below is my script to read the values into the array

@CustomScriptAction(
    input = ['v_outputlist', 'v_todaystring', 'v_cftype','v_comment','v_capinc', 'v_accprofile', 'v_testnegative'],    
    output = 'v_outputlist'             
)
 
def customScript() {

		
    	v_outputlist[0] = v_todaystring
    	v_outputlist[1] = v_cftype
    	v_outputlist[2] = "SZAR"
    	v_outputlist[3] = " "
    	v_outputlist[4] = "SZAR"
    	v_outputlist[5] = v_accprofile
    	v_outputlist[6] = v_capinc
    	v_outputlist[7] = v_testnegative
    	v_outputlist[8] = " "
		v_outputlist[9] = " "
		v_outputlist[10] = v_comment
}

can anyone please help me out?

Hi @shuan.vanhuyssteen

try using Join Strings - Split String in this case.

Join the strings into 1 string

Then split it into a list

It will overwrite the list values in each loop.

join-split.zip (728 Bytes)

I will give it a go thank you very much!

1 Like