This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Summing Values
#7
Of course a Boolean is not a number. For binary use such script.
Code:
function tag_sum(tag)
  local objects, result

  result = 0
  objects = grp.tag(tag)

  for _, object in ipairs(objects) do
    if object.data then
    result = result + 1
    end 
  end

  return result
end



sum=tag_sum('Supply'))


grp.checkwrite('1/1/1', sum)
------------------------------
Ctrl+F5
Reply


Messages In This Thread
RE: Summing Values - by Daniel - 04.11.2019, 08:23
RE: Summing Values - by Daniel - 04.11.2019, 10:41
RE: Summing Values - by Daniel - 04.11.2019, 14:26
RE: Summing Values - by Tokatubs - 04.11.2019, 23:31
RE: Summing Values - by Daniel - 05.11.2019, 08:26

Forum Jump: