I collect an input value to get members ‘category’ and if it’s empty disable the count, if not empty run query to count.
1st condition is the ‘membercategory’, it works fine!
2nd condition is the ‘validityday’, I generated in backend like this:
export function Members_afterQuery(item, context) {
var payment_date = new Date (item.lastpaymentdate);
var today_date = new Date();
My huge problem is ‘.between’ condition does not work for that calculated field.
I tried .gt, .lt, etc. but is seems this field do not cooperate with this query.
How can I put that important condition in the code?
My site url is: https://www.wedmet.net
If somebody register the next page is that dynamic page with this counter on it.
You have two instances of the $w.onReady(function(){} event handler in the code for that page. This will result in unpredictable behavior. The first instance should end up overriding the first instance.
In addition, you also have similar code in the site code panel. This causes several errors that appear in the Developers console.
These problems will have to be fixed before the code can be checked effectively.
yep you got the truth so I clear out my chaos, restructure my code and check errors as well.
Now no errors, I got only one onReady handler but that counter still not working well
E.g. I have to submit the collection (save button with submit function to database) twice and the result in counter only appearing after the 2nd submit. What is the matter with the first?
I collect an input value to get members ‘category’ and if it’s empty disable the count, if not empty run query to count.
My problem is the counter do not show the right numbers (members number in a category with validitiday between 0-31).
'validityday’is generated in backend like this:
export function Members_afterQuery(item, context) { var payment_date = new Date (item.lastpaymentdate); var today_date = new Date(); item.validityday = 30 - (Math.floor((today_date - payment_date) / (10006060*24))); return item; }
It works fine.
My site url is: https://www.wedmet.net If somebody register the next page is that dynamic page with this counter on it.
This 2 condition is so easy and simple so I do not understand what is wrong with it.
I put a console.log() statement in your calculation for validitydays in the backend and I see it’s getting NaN. Could be because the lastPaymentDate field is null for all rows except one.
We are unable to invest a lot in debugging site code and we do not rewrite code for users, but we provide the directions and tools to overcome the issues they’re facing. When you have things worked out we’ll be glad to assist with issues and questions you might have.