Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

find in sub-tables

Hi everyone, 

 

I'm working with a table (BOM), which first column (Components List) has format "table" as well. I need to use the command "find" inside the BOM to look up the value "WE" for instance. 

The code :

BOM.find("WE")

is unsuccessful since "WE" is the name of the sub-table, so it does not directly read it. 

 

Thanks for helping. 

Lorenzo

 

1 REPLY
Solution
Solution
Accepted by topic author Lorenzo
‎11-24-2016 04:44 AM

Re: find in sub-tables

Hello Lorenzo,

In the upcoming version 13.1 this will work.

 

Until then you have to use a loop to search for the cell:

is
do
	local subTableName := "test";
	local searchRow := 1;
	
	local row := -1;
	
	for local i := 1 to TableFile.getColumnYDim(searchRow) loop
		if tablefile[searchRow,i].name = subTableName then
			row := i;
			exitloop;
		end;
	next;

	if row > 0 then
		print "Found sub table in line ", row;
	else
		print "Sub table not found!";
	end
end;
Regards,

Ralf