Variables fetch

I have this script to locate the process variables
camForm.on('form-loaded', function() { camForm.variableManager.fetchVariable('sys_qtd_anexo'); )}
however, I would like to loop inside the form-loaded script with the value contained within this variable ‘sys_qtd_anexo’ to locate other variables with the id according to the value of the variable
camForm.on('form-loaded', function() { for(int i=0; i<sys_qtd_anexo;i++){ camForm.variableManager.fetchVariable('sys_anexo_filename_'+i); } })