Combine table with text entry and load in to sql

Hi,

I would like to get table dataset and individual entry related to row in the table and load all in to sql databse.

Here is my table and text entries.

Table where it will be loaded:

I started this way, but it will take ages and code will be very long, as there can be more rows to upload than 14.

#tank is loaded from LCD display and will range from 1-20
#par1 is loaded from custom properties as part of textvalue
#res1 is loaded from text field
#val1 is loaded from label


date = event.source.parent.getComponent('Container 1').getComponent('Popup Calendar').date
tank = event.source.parent.getComponent('Container').getComponent('LED Display').value
par1 = event.source.parent.getComponent('Container 2').getComponent('Value1').id
res1 = event.source.parent.getComponent('Container 2').getComponent('Value1').text
val1 = event.source.parent.getComponent('Container 2').getComponent('Label 7').text
here code to upload this to sql
if event.source.parent.getComponent('Container 2').getComponent('Table').Max >=2:
	date = event.source.parent.getComponent('Container 1').getComponent('Popup Calendar').date
	tank = event.source.parent.getComponent('Container').getComponent('LED Display').value
	par2 = event.source.parent.getComponent('Container 2').getComponent('Value2').id
	res2 = event.source.parent.getComponent('Container 2').getComponent('Value2').text
	val2 = event.source.parent.getComponent('Container 2').getComponent('Label 8').text
	here code to upload this to sql
if event.source.parent.getComponent('Container 2').getComponent('Table').Max >=3:
	 date = event.source.parent.getComponent('Container 1').getComponent('Popup Calendar').date
	 tank = event.source.parent.getComponent('Container').getComponent('LED Display').value
	 par3 = event.source.parent.getComponent('Container 2').getComponent('Value3').id
	 res3 = event.source.parent.getComponent('Container 2').getComponent('Value3').text
	 val3 = event.source.parent.getComponent('Container 2').getComponent('Label 9').text
	 here code to upload this to sql

Unless there is better way to do that. In general what I want to do is to display predefined paramameters from sql databse and allow operator to add values and validate against low and high and load this in to sql.

Regards
Pawel

Consider putting your grouped objects (date, tank, par, res, val) into a template, then using a template repeater to construct those objects dynamically. Then you can iterate over the template repeater’s loaded templates more easily.