cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Updating infotable property

SOLVED
Highlighted
Level 7

Updating infotable property

Hi,

I need to update property of one infotable based output of other infotable.

Scenario : I have infotable with property Boolean type and its value should set to true if other property of strng type value matches output of 2nd infotable.

 

Example : infotable1 properties : isSelected(Boolean) , Name (string) 

infotable2: Name(string)  

if Name matches in infotable1 and infotable 2 then isSelected in infotable1 should set to true.

 

Can some one help me how to achieve this?

 

Thanks,

Lakshmi

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Updating infotable property

Hi

One suggestion I have is to write a service that loops through the second infotable (as discussed in your scenario) and then compares that row with each row in the first infotable and if the name property in both match then update the boolean property of the first. A rough example of this code would be:

 

///// infoTable A being your first infotable property and B your second
var TableDuplicate = me.InfoTableA;
var tableLength = TableDuplicate.rows.length;
for (var x=0; x < tableLength; x++) {
var row = TableDuplicate.rows[x];
row.IsSelected = false;
}

var tableLength = me.InfoTableB.rows.length;
for (var x=0; x < tableLength; x++) {
var rowx = me.InfoTableB.rows[x];

var tableLengthy = TableDuplicate.rows.length;
for (var y=0; y < tableLengthy; y++) {
var rowy = TableDuplicate.rows[y];
if(rowx.Name == rowy.Name){
rowx.IsSelected == true;
}
}
}
me.InfoTableA = TableDuplicate;

 

If you look at the script, you will see I have made a duplicate of the first infotable and set all the boolean properties to false. This is to prevent unnecessary logging of the infotable property as each boolean property being set to true will cause a property log.  I initially set all the boolean properties to false to make sure that only the current second infotable names have their boolean properties set to true in the first infotable. I finally then set the first infotable property to be the manipulated infotable property.

 

Hope that helps

2 REPLIES 2

Re: Updating infotable property

Hi

One suggestion I have is to write a service that loops through the second infotable (as discussed in your scenario) and then compares that row with each row in the first infotable and if the name property in both match then update the boolean property of the first. A rough example of this code would be:

 

///// infoTable A being your first infotable property and B your second
var TableDuplicate = me.InfoTableA;
var tableLength = TableDuplicate.rows.length;
for (var x=0; x < tableLength; x++) {
var row = TableDuplicate.rows[x];
row.IsSelected = false;
}

var tableLength = me.InfoTableB.rows.length;
for (var x=0; x < tableLength; x++) {
var rowx = me.InfoTableB.rows[x];

var tableLengthy = TableDuplicate.rows.length;
for (var y=0; y < tableLengthy; y++) {
var rowy = TableDuplicate.rows[y];
if(rowx.Name == rowy.Name){
rowx.IsSelected == true;
}
}
}
me.InfoTableA = TableDuplicate;

 

If you look at the script, you will see I have made a duplicate of the first infotable and set all the boolean properties to false. This is to prevent unnecessary logging of the infotable property as each boolean property being set to true will cause a property log.  I initially set all the boolean properties to false to make sure that only the current second infotable names have their boolean properties set to true in the first infotable. I finally then set the first infotable property to be the manipulated infotable property.

 

Hope that helps

Re: Updating infotable property

Hi @TIRUNL.

 

If the solution provided by @eengelbrecht allowed you to solve your issue, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon