Cancel
Showing results for 
Search instead for 
Did you mean: 

Number of specific MU in buffer

Pioneer
Pioneer

Hi Guys,

 

Short question: I have different types of MUs in a buffer. I want to know how many of one type are in the buffer. What is the code?

 

I know the .Buffer.numMu method, however this returns the total number of MUs in the buffer and not of the specific type.

 

Thanks!

4 REPLIES

Re: Number of specific MU in buffer

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi William,

 

the buffer doesn't have a counter for the different MU types.

 

But you can use the following code to compute the numbers:

is
do
	local t:table;
	t.create; -- Create the table
	
	t.RowIndex := true; -- Turn on row index
	t.setDataType(1, "integer"); -- Set type of first column to integer
	
	-- Loop over all MUs in the buffer with name 'Buffer' and count the different types
	for local i := 1 to Buffer.NumMU loop
		local mu := Buffer.MU(i);
		local muName := mu.name;
		local row := t.getRowNo(muName);
		if row > 0 then 
			t[1, row] := t[1, row] + 1;
		else
			local newRow := t.ydim+1;
			t[0, newRow] := muName;
			t[1, newRow] := 1;
		end;
	next;
	
	-- Print the result to the console window
	for local i := 1 to t.ydim loop
		print t[0, i], ": ", t[1, i];
	next;
end;

 Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Number of specific MU in buffer

Pioneer
Pioneer

Thank you Ralf!

 

A related question: (how) is it possible to move that specific MU to another station?

Re: Number of specific MU in buffer

Siemens Phenom Siemens Phenom
Siemens Phenom

Just use the 'move' method:

 

<MU_path>.move(Target:<any> [,Position:<length>]);
<MU_path>.move(Index:<integer> [,<length>)];

 

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Number of specific MU in buffer

Pioneer
Pioneer

Thanks! I will try it, if I don't manage to fix it I will ask for some further advice Smiley Wink