Limit Records

Ask your questions here.
garthswest
Posts: 19
Joined: 13 Jul 2021, 11:51
Name: Garth
Location: South Africa, Cape Town

Limit Records

Post by garthswest »

Hi All,

Is it at all possible to limit the number of records added to an Entity?
Eg:
Entity > Subscription
Fields: Amount | % Paid
Amount is a currency amount
% Paid is a List: Progress type

If I add a payment amount and make the '% Paid' field 50% that is fine. Then I can just edit the record, update the amount and % and it's all good. However i still have the option of adding another payment which would give me 2 entries.

Can I set limits to only add one payment, then all i have to do is edit the record when a new payment is added.

Hope that makes sense
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

Re: Limit Records

Post by Didou12 »

Hi

yes,

check here and adapt conditions for you :
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
garthswest
Posts: 19
Joined: 13 Jul 2021, 11:51
Name: Garth
Location: South Africa, Cape Town

Re: Limit Records

Post by garthswest »

Thank you....i did see that.

Was hoping this could be done on the entity level but i will try this, should do the trick :)
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

Re: Limit Records

Post by Didou12 »

Yeah try with a condition and COUNT(*), and if it's already created, you block the form

Tell me more about your conditions if you want some help :)
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
garthswest
Posts: 19
Joined: 13 Jul 2021, 11:51
Name: Garth
Location: South Africa, Cape Town

Re: Limit Records

Post by garthswest »

Thank you for the reply....

So we have an entity called 'Members' and a sub entity called 'Subs'
The idea is when a member is added, we can capture the annual subscription (subs). Let's say for example the annual subscription is $1000 and the member pays $500, then we make the progress 50%. When the member pays their balance, we don't want to create a new record because that then gives us 2 entries of $500 and two progress bars. We can of course jsut edit the existing entry and change the amount paid to $1000 and the progress bar to 100%..that works perfectly.

The problem could arise that a user might not do that (edit existing record) but rather add a new record.

The limit number of records works fine for our purposes :)

What would be great is when creating the entity that you can choose if the entity can take multiple records or only one.

Hope it's clear
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

Re: Limit Records

Post by Didou12 »

What would be great is when creating the entity that you can choose if the entity can take multiple records or only one.
As I said, you can do that with ajax (see link).

I can help you for your ajax field, but what is the condition ? you need to have a condition (user ? sub number ? name of the subscriber ? ...).
With that, you can check in the database if the row is already created or not, and block new add and display a message like "please edit your sub".

Do you understand ?

but for that, you need to have a condition to check in the database.
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
garthswest
Posts: 19
Joined: 13 Jul 2021, 11:51
Name: Garth
Location: South Africa, Cape Town

Re: Limit Records

Post by garthswest »

Thank you, yes I understand!

I think the condition would be based on the 'sub'
So once a 'sub' has been added it can only be edited, no new 'sub' can be created, unless of course it is deleted.

I assume the condition would be to check if a record has a sub created and then prevent adding of new subs

Does that help?
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

Re: Limit Records

Post by Didou12 »

Yes

But one sub created by user ? it's important to have a condition with your fields. What are your fields in this entity ? and who can add a record ?
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
garthswest
Posts: 19
Joined: 13 Jul 2021, 11:51
Name: Garth
Location: South Africa, Cape Town

Re: Limit Records

Post by garthswest »

Sorry I understand now

SUB
ID
Date added
Date updated
Created by
Parent - Member
Amount - Input Numeric Field
% Paid - Progress

So only 1 user is allowed to add 'subs', the same user is allowed to add a 'member'

All other users only have viewing rights

*Edit
Maybe I am over complicating things. I could just add the user to their own user group and limit using your first example
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

Re: Limit Records

Post by Didou12 »

So, what is the limit :

Created by
or
Parent - Member

?

If it's parent, can you give me the field number :)
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
Post Reply