count app items
Hello, I tried Globi Flow now. I hoped to find some additional functions. One of these would be, to count items of an App an place the number in a text field or number field to then use it in a calculation. Is that possible?
-
Hello Rainer, an example:
App "invoices" has:
3 invoices with status "abo" (each item has a number 15-01, 15-02, 15-03)
3 invoices with status "job" (each item has a number /01, /02, /03)A new number should be added after/while adding a new item:
invoice 4 with status "job" = /04
I tried to work with item IDs. Works... as far as no item gets deleted.
-
Hi Jan,
sorry, have forgotten to answer.
Auto-incrementing numbers are a real problem. See here https://help.podio.com/hc/communities/public/questions/203556128-Auto-incrementing-unique-number-ranges-per-customer?locale=en-us
And I'm not sure if I understand your use case right. How can you create the same number for "job" (/03) and "abo" (15-03) using item ID which is unique for each item? Can the status of an invoice change?
One possible solution:
In invoices create a relation field "Former invoices" with relation to the App Invoices itself ,
a calculation field "xxx"//@invoice title "invoice"
(You need this for a later search in GF.)
and a calculation field "number" with
var statusFormer = @all of status; // outgoing relation var statusThis = @status var sameStat = []; for(var i = 0; i < statusFormer.length;i++){ if(statusFormer[i] == status){ sameStat.push (statusFormer[i]); } }; var number = ("00"+ (sameStat.length +1)).substr(-2) // calculates the quantity of related items and sets the leading 0 var showJob = "/" + number; var showAbo = "15-" + number; statusThis == "Job" ? showJob : showAbo
Create a GF-flow: When item created, search for items in app invoices where field XXX equal to value field XXX of this item (ignore itself), update "Former invoices" value Ref(Invoices). All former invoices will be related to the current item. The field "Number" counts how many former items with the same status as the current item are related (sameStat.length +1 = the number of this item). You will always have the exact number, cause if one item is deleted the number changes. BUt take care: Cause numbers change it's not a unique number.
Rainer
-
Hej Rainer, you understood it right and this makes total sense BUT, there will be about 500 invoices added to the latest item. Or is there a difference between being related and added to a relation field?
Search for items stops at 99, so this also wont work.
I thought about, asking for the latest added invoice with status "Job". That way, I could just get the latest number and add one. Would that work?
-
Yes, 99 is limit for normal GF-Accounts, 299 for Business Accounts (I think Diamond Plan and higher).
You should create a temporary field in Invoices = date created on (if you have no other date field) and do several search runs filtered by date ranges.I thought about, asking for the latest added invoice with status "Job". That way, I could just get the latest number and add one. Would that work?
Could be, just try it.
-
Hej Rainer, date created on was not working. I found a workaround that is very easy to use. It's not that smart but it works even with very complex systems. Here we go:
add workspace "system"
add app "system"
add item "system"Every item created in every workspace, that needs auto-incrementing numbers will automatically be added there. That's the easiest way to get it done. Another app will then be able to make reports and other super cool stuff, that was possible only via reports.
In the future one can only hope, that Podio will release something like "hide field".
Please sign in to leave a comment.
Comments
11 comments