Using For Loops to parse incoming strings???

mkleynhansmkleynhans Junior MemberPosts: 76
Hi all,

I am trying to find a more efficient way of updating various variables rather than typing lines and lines and wondered,
can you use a for loop to process incoming strings to variables??
For precis inputs, I have lines setup listening for String events where;
DATA_EVENT[dvASwitcher] //ROOM INPUT FEEDBACK
{
STRING:
    {
    SELECT
	{
	//OUTPUT 1 & 2 IN LOUNGE
	ACTIVE (find_string (DATA.TEXT,'CL0I1O1 2',1))	: { A_Output1  = 1  A_Output2  = 1 }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O1 2',1))	: { A_Output1  = 2  A_Output2  = 2 }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O1 2',1))	: { A_Output1  = 3  A_Output2  = 3 }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O1 2',1))	: { A_Output1  = 4  A_Output2  = 4 }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O1 2',1))	: { A_Output1  = 5  A_Output2  = 5 }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O1 2',1))	: { A_Output1  = 6  A_Output2  = 6 }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O1 2',1))	: { A_Output1  = 7  A_Output2  = 7 }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O1 2',1))	: { A_Output1  = 8  A_Output2  = 8 }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O1 2',1))	: { A_Output1  = 9  A_Output2  = 9 }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O1 2',1))	: { A_Output1  = 10 A_Output2  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O1 2',1))	: { A_Output1  = 11 A_Output2  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O1 2',1))	: { A_Output1  = 12 A_Output2  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O1 2',1))	: { A_Output1  = 13 A_Output2  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O1 2',1))	: { A_Output1  = 14 A_Output2  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O1 2',1))	: { A_Output1  = 15 A_Output2  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O1 2',1))	: { A_Output1  = 16 A_Output2  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O1 2',1))	: { A_Output1  = 17 A_Output2  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O1 2',1))	: { A_Output1  = 18 A_Output2  = 18 }
	//OUTPUT 3 & 4 IN KITCHEN
	ACTIVE (find_string (DATA.TEXT,'CL0I1O3 4',1))	: { A_Output3  = 1  A_Output4  = 1 }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O3 4',1))	: { A_Output3  = 2  A_Output4  = 2 }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O3 4',1))	: { A_Output3  = 3  A_Output4  = 3 }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O3 4',1))	: { A_Output3  = 4  A_Output4  = 4 }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O3 4',1))	: { A_Output3  = 5  A_Output4  = 5 }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O3 4',1))	: { A_Output3  = 6  A_Output4  = 6 }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O3 4',1))	: { A_Output3  = 7  A_Output4  = 7 }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O3 4',1))	: { A_Output3  = 8  A_Output4  = 8 }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O3 4',1))	: { A_Output3  = 9  A_Output4  = 9 }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O3 4',1))	: { A_Output3  = 10 A_Output4  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O3 4',1))	: { A_Output3  = 11 A_Output4  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O3 4',1))	: { A_Output3  = 12 A_Output4  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O3 4',1))	: { A_Output3  = 13 A_Output4  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O3 4',1))	: { A_Output3  = 14 A_Output4  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O3 4',1))	: { A_Output3  = 15 A_Output4  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O3 4',1))	: { A_Output3  = 16 A_Output4  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O3 4',1))	: { A_Output3  = 17 A_Output4  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O3 4',1))	: { A_Output3  = 18 A_Output4  = 18 }
	//OUTPUT 5,6 & 7 IN POOL
	ACTIVE (find_string (DATA.TEXT,'CL0I1O5 6 7',1)) : { A_Output5 = 1  A_Output6 = 1 A_Output7 = 1}
	ACTIVE (find_string (DATA.TEXT,'CL0I2O5 6 7',1)) : { A_Output5 = 2  A_Output6 = 2 A_Output7 = 2}
	ACTIVE (find_string (DATA.TEXT,'CL0I3O5 6 7',1)) : { A_Output5 = 3  A_Output6 = 3 A_Output7 = 3}
	ACTIVE (find_string (DATA.TEXT,'CL0I4O5 6 7',1)) : { A_Output5 = 4  A_Output6 = 4 A_Output7 = 4}
	ACTIVE (find_string (DATA.TEXT,'CL0I5O5 6 7',1)) : { A_Output5 = 5  A_Output6 = 5 A_Output7 = 5}
	ACTIVE (find_string (DATA.TEXT,'CL0I6O5 6 7',1)) : { A_Output5 = 6  A_Output6 = 6 A_Output7 = 6}
	ACTIVE (find_string (DATA.TEXT,'CL0I7O5 6 7',1)) : { A_Output5 = 7  A_Output6 = 7 A_Output7 = 7}
	ACTIVE (find_string (DATA.TEXT,'CL0I8O5 6 7',1)) : { A_Output5 = 8  A_Output6 = 8 A_Output7 = 8}
	ACTIVE (find_string (DATA.TEXT,'CL0I9O5 6 7',1)) : { A_Output5 = 9  A_Output6 = 9 A_Output7 = 9}
	ACTIVE (find_string (DATA.TEXT,'CL0I10O5 6 7',1)) : { A_Output5 = 10 A_Output6 = 10 A_Output7 = 10}
	ACTIVE (find_string (DATA.TEXT,'CL0I11O5 6 7',1)) : { A_Output5 = 11 A_Output6 = 11 A_Output7 = 11}
	ACTIVE (find_string (DATA.TEXT,'CL0I12O5 6 7',1)) : { A_Output5 = 12 A_Output6 = 12 A_Output7 = 12}
	ACTIVE (find_string (DATA.TEXT,'CL0I13O5 6 7',1)) : { A_Output5 = 13 A_Output6 = 13 A_Output7 = 13}
	ACTIVE (find_string (DATA.TEXT,'CL0I14O5 6 7',1)) : { A_Output5 = 14 A_Output6 = 14 A_Output7 = 14}
	ACTIVE (find_string (DATA.TEXT,'CL0I15O5 6 7',1)) : { A_Output5 = 15 A_Output6 = 15 A_Output7 = 15}
	ACTIVE (find_string (DATA.TEXT,'CL0I16O5 6 7',1)) : { A_Output5 = 16 A_Output6 = 16 A_Output7 = 16}
	ACTIVE (find_string (DATA.TEXT,'CL0I17O5 6 7',1)) : { A_Output5 = 17 A_Output6 = 17 A_Output7 = 17}
	ACTIVE (find_string (DATA.TEXT,'CL0I18O5 6 7',1)) : { A_Output5 = 18 A_Output6 = 18 A_Output7 = 18}
	//OUTPUT 8 IN UTILITY ROOM
	ACTIVE (find_string (DATA.TEXT,'CL0I1O8',1))	: { A_Output8  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O8',1))	: { A_Output8  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O8',1))	: { A_Output8  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O8',1))	: { A_Output8  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O8',1))	: { A_Output8  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O8',1))	: { A_Output8  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O8',1))	: { A_Output8  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O8',1))	: { A_Output8  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O8',1))	: { A_Output8  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O8',1))	: { A_Output8  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O8',1))	: { A_Output8  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O8',1))	: { A_Output8  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O8',1))	: { A_Output8  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O8',1))	: { A_Output8  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O8',1))	: { A_Output8  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O8',1))	: { A_Output8  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O8',1))	: { A_Output8  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O8',1))	: { A_Output8  = 18 }
	//OUTPUT 9 IN SEWING ROOM
	ACTIVE (find_string (DATA.TEXT,'CL0I1O9',1))	: { A_Output9  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O9',1))	: { A_Output9  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O9',1))	: { A_Output9  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O9',1))	: { A_Output9  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O9',1))	: { A_Output9  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O9',1))	: { A_Output9  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O9',1))	: { A_Output9  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O9',1))	: { A_Output9  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O9',1))	: { A_Output9  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O9',1))	: { A_Output9  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O9',1))	: { A_Output9  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O9',1))	: { A_Output9  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O9',1))	: { A_Output9  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O9',1))	: { A_Output9  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O9',1))	: { A_Output9  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O9',1))	: { A_Output9  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O9',1))	: { A_Output9  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O9',1))	: { A_Output9  = 18 }
	//OUTPUT 10 IN BATHROOM
	ACTIVE (find_string (DATA.TEXT,'CL0I1O10',1))	: { A_Output10  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O10',1))	: { A_Output10  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O10',1))	: { A_Output10  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O10',1))	: { A_Output10  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O10',1))	: { A_Output10  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O10',1))	: { A_Output10  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O10',1))	: { A_Output10  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O10',1))	: { A_Output10  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O10',1))	: { A_Output10  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O10',1))	: { A_Output10  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O10',1))	: { A_Output10  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O10',1))	: { A_Output10  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O10',1))	: { A_Output10  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O10',1))	: { A_Output10  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O10',1))	: { A_Output10  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O10',1))	: { A_Output10  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O10',1))	: { A_Output10  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O10',1))	: { A_Output10  = 18 }
	//OUTPUT 11 IN DRESSING ROOM
	ACTIVE (find_string (DATA.TEXT,'CL0I1O11',1))	: { A_Output11  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O11',1))	: { A_Output11  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O11',1))	: { A_Output11  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O11',1))	: { A_Output11  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O11',1))	: { A_Output11  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O11',1))	: { A_Output11  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O11',1))	: { A_Output11  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O11',1))	: { A_Output11  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O11',1))	: { A_Output11  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O11',1))	: { A_Output11  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O11',1))	: { A_Output11  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O11',1))	: { A_Output11  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O11',1))	: { A_Output11  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O11',1))	: { A_Output11  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O11',1))	: { A_Output11  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O11',1))	: { A_Output11  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O11',1))	: { A_Output11  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O11',1))	: { A_Output11  = 18 }
	//OUTPUT 12 IN SHOWER
	ACTIVE (find_string (DATA.TEXT,'CL0I1O12',1))	: { A_Output12  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O12',1))	: { A_Output12  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O12',1))	: { A_Output12  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O12',1))	: { A_Output12  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O12',1))	: { A_Output12  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O12',1))	: { A_Output12  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O12',1))	: { A_Output12  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O12',1))	: { A_Output12  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O12',1))	: { A_Output12  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O12',1))	: { A_Output12  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O12',1))	: { A_Output12  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O12',1))	: { A_Output12  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O12',1))	: { A_Output12  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O12',1))	: { A_Output12  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O12',1))	: { A_Output12  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O12',1))	: { A_Output12  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O12',1))	: { A_Output12  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O12',1))	: { A_Output12  = 18 }
	//OUTPUT 13 IN MORNING ROOM
	ACTIVE (find_string (DATA.TEXT,'CL0I1O13',1))	: { A_Output13  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O13',1))	: { A_Output13  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O13',1))	: { A_Output13  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O13',1))	: { A_Output13  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O13',1))	: { A_Output13  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O13',1))	: { A_Output13  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O13',1))	: { A_Output13  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O13',1))	: { A_Output13  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O13',1))	: { A_Output13  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O13',1))	: { A_Output13  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O13',1))	: { A_Output13  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O13',1))	: { A_Output13  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O13',1))	: { A_Output13  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O13',1))	: { A_Output13  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O13',1))	: { A_Output13  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O13',1))	: { A_Output13  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O13',1))	: { A_Output13  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O12',1))	: { A_Output13  = 18 }
	//OUTPUT 14 IN SAM & ED'S ROOM
	ACTIVE (find_string (DATA.TEXT,'CL0I1O14',1))	: { A_Output14  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O14',1))	: { A_Output14  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O14',1))	: { A_Output14  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O14',1))	: { A_Output14  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O14',1))	: { A_Output14  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O14',1))	: { A_Output14  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O14',1))	: { A_Output14  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O14',1))	: { A_Output14  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O14',1))	: { A_Output14  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O14',1))	: { A_Output14  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O14',1))	: { A_Output14  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O14',1))	: { A_Output14  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O14',1))	: { A_Output14  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O14',1))	: { A_Output14  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O14',1))	: { A_Output14  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O14',1))	: { A_Output14  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O14',1))	: { A_Output14  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O14',1))	: { A_Output14  = 18 }
	//OUTPUT 15 & 16 IN MASTER BEDROOM
	ACTIVE (find_string (DATA.TEXT,'CL0I1O15 16',1))	: { A_Output15  = 1  A_Output16  = 1 }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O15 16',1))	: { A_Output15  = 2  A_Output16  = 2 }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O15 16',1))	: { A_Output15  = 3  A_Output16  = 3 }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O15 16',1))	: { A_Output15  = 4  A_Output16  = 4 }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O15 16',1))	: { A_Output15  = 5  A_Output16  = 5 }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O15 16',1))	: { A_Output15  = 6  A_Output16  = 6 }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O15 16',1))	: { A_Output15  = 7  A_Output16  = 7 }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O15 16',1))	: { A_Output15  = 8  A_Output16  = 8 }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O15 16',1))	: { A_Output15  = 9  A_Output16  = 9 }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O15 16',1))	: { A_Output15  = 10 A_Output16  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O15 16',1))	: { A_Output15  = 11 A_Output16  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O15 16',1))	: { A_Output15  = 12 A_Output16  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O15 16',1))	: { A_Output15  = 13 A_Output16  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O15 16',1))	: { A_Output15  = 14 A_Output16  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O15 16',1))	: { A_Output15  = 15 A_Output16  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O15 16',1))	: { A_Output15  = 16 A_Output16  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O15 16',1))	: { A_Output15  = 17 A_Output16  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O15 16',1))	: { A_Output15  = 18 A_Output16  = 18 }
	//OUTPUT 15 TO CINEMA AMPLIFIER
	ACTIVE (find_string (DATA.TEXT,'CL0I1O17',1))	: { A_Output17  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O17',1))	: { A_Output17  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O17',1))	: { A_Output17  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O17',1))	: { A_Output17  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O17',1))	: { A_Output17  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O17',1))	: { A_Output17  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O17',1))	: { A_Output17  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O17',1))	: { A_Output17  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O17',1))	: { A_Output17  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O17',1))	: { A_Output17  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O17',1))	: { A_Output17  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O17',1))	: { A_Output17  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O17',1))	: { A_Output17  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O17',1))	: { A_Output17  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O17',1))	: { A_Output17  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O17',1))	: { A_Output17  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O17',1))	: { A_Output17  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O17',1))	: { A_Output17  = 18 }
	//OUTPUT 18 TO BARN AMPLIFIER
	ACTIVE (find_string (DATA.TEXT,'CL0I1O18',1))	: { A_Output18  = 1  }
	ACTIVE (find_string (DATA.TEXT,'CL0I2O18',1))	: { A_Output18  = 2  }
	ACTIVE (find_string (DATA.TEXT,'CL0I3O18',1))	: { A_Output18  = 3  }
	ACTIVE (find_string (DATA.TEXT,'CL0I4O18',1))	: { A_Output18  = 4  }
	ACTIVE (find_string (DATA.TEXT,'CL0I5O18',1))	: { A_Output18  = 5  }
	ACTIVE (find_string (DATA.TEXT,'CL0I6O18',1))	: { A_Output18  = 6  }
	ACTIVE (find_string (DATA.TEXT,'CL0I7O18',1))	: { A_Output18  = 7  }
	ACTIVE (find_string (DATA.TEXT,'CL0I8O18',1))	: { A_Output18  = 8  }
	ACTIVE (find_string (DATA.TEXT,'CL0I9O18',1))	: { A_Output18  = 9  }
	ACTIVE (find_string (DATA.TEXT,'CL0I10O18',1))	: { A_Output18  = 10 }
	ACTIVE (find_string (DATA.TEXT,'CL0I11O18',1))	: { A_Output18  = 11 }
	ACTIVE (find_string (DATA.TEXT,'CL0I12O18',1))	: { A_Output18  = 12 }
	ACTIVE (find_string (DATA.TEXT,'CL0I13O18',1))	: { A_Output18  = 13 }
	ACTIVE (find_string (DATA.TEXT,'CL0I14O18',1))	: { A_Output18  = 14 }
	ACTIVE (find_string (DATA.TEXT,'CL0I15O18',1))	: { A_Output18  = 15 }
	ACTIVE (find_string (DATA.TEXT,'CL0I16O18',1))	: { A_Output18  = 16 }
	ACTIVE (find_string (DATA.TEXT,'CL0I17O18',1))	: { A_Output18  = 17 }
	ACTIVE (find_string (DATA.TEXT,'CL0I18O18',1))	: { A_Output18  = 18 }
	}
    }
}

Can this be done??

Cheers, Mike

Comments

  • ericmedleyericmedley Senior Member - 3709 Posts Posts: 4,159
    The answer is yes - there are times where you can and should use a for loop to parse your way through an incoming string. But IMHO this is not one of them.

    While the method you posted "works" it is actually a pretty labor intensive way to get there. Bear in mind string functions are some of the most spendy processes to call. They require quite a few CPU cycles to complete. So, the fewest steps you can take with a string function - the better.

    Here's what I'd do with your switcher return. This is just a simplified method to illustrate the concept.
     
    dtat_event[myDevice]{
      string:{
        stack_var char MyBuffer[12];
        MyBuffer=data.text
        remove_string(MyBuffer,'I',1)
        A_Input=atoi(MyBuffer);
        remove_string(MyBuffer,'O',1)
        A_Output=atoi(MyBuffer);
        }//stirng
      }// data_event
    

    the idea is that the strings you are getting are always formatted in a similar fashion. So just chop your way through them and just grab the items you need, convert them into integers and move on.

    the remove_string will work its way through the string starting at position indicated in the function call (in this case cell 1) and remove all characters from that position until the char "I" so with the example of "CL0I2O3" the result will end up being "2O3" The next step, the atoi() basically looks at the string and finds the first numeric character and returns an integer value of that character. In this case atoi() will return a "2" integer. That's my input value.

    The next remove string chops off everything left of the "O" leaving MyBuffer to be "3" then the atoi converts the string "3" to an integer 3 and that's the output. done.

    There are a number of methods to parse this string. you could use mid_string, right_string, etc... but, any of these methods will use far fewer CPU steps to get the job done.
  • viningvining X Member Posts: 4,353
    You need to actually parse your returned string and used the parsed individual values to update an array or structure and then update your UI's using a for loop on that array or structure.
  • mkleynhansmkleynhans Junior Member Posts: 76
    As always thanks guys, will have a play with some options on this!!
Sign In or Register to comment.