Add action behavior

HI, I build an app to insert order but i would like to have a limit to insert new products, i tried to insert in BEHAVIOR this rule COUNT(Products[Id Products],([User] = [Id Products].[User])) >= 0 but the rule is not correct. How can i resolve it?

0 31 1,028
31 REPLIES 31

Are you trying to count this in a same table or in another one?

in this tableโ€ฆin reality I would need a rule that counts the number of products inserted and the number of products that can be purchased โ€ฆiโ€™ve another table โ€œCONTRACTSโ€; in โ€œCONTRACTSโ€ table iโ€™ve the the maximum number of products that can be purchased; in โ€œPRODUCTSโ€ table i inserted a virtual column with LOOKUP the maximum products that can bu purchased

Do you want to just check the quantity of products that can be purschased or do you need to deduct existing orders from this table?

i need a counterโ€ฆfrom maximum to zero. I tried also to insert NOT <0, with a virtual column to count the inserted products, but the action works because the counter also counts below zero (-1)

Not 100% sure but probablyโ€ฆ

LOOKUP([_THISROW].[Id Products],โ€œConcratsโ€,โ€œId Productsโ€,โ€œMaximumโ€) - SUM(SELECT(Products[Quantity],[Id Products]=[_THISROW].[Id Products])) >= [Quantity]

no, it doesnโ€™t work, i tried to change the forumla:

i added a virtual column to count the inserted products in PRODUCT TABLE

LOOKUP([_THISROW].[Customers],โ€œContractsโ€,โ€œCustomersโ€,โ€œNยฐ Products Includedโ€) - COUNT(SELECT(Products[Nยฐ inserted products],[Customers]=[_THISROW].[Customers])) >= [Nยฐ Inserted products]

If i use this rule in another virtual column (without >= [Nยฐ Inserted products]) the result is 0 , than is correct. I tried also to insert a virtual column"PLUGGABLE" in PRODUCTS TABLE to give me result Y/N if result is zero, and in ADD ACTION the rule [_THISROW].[PLUGGABLE]=Y but it doesnโ€™t works

Maybe iโ€™ve to commutate the virtual column in a normal row or iโ€™ve to put the virtual column in CONTRACT table. What do you think?

Without knowing your table/column structure itโ€™s litle bit difficult to say what would be the exact formula in your case.

i send you a pic to explain my tables

Hi Aleksiโ€ฆcan you help me with this ticket?

Sorryโ€ฆ I have somehow missed your reply. Let me check this oneโ€ฆ soon.

Is the customer in your Products table a supplier?

What you mean? i try to explain the process: The customers stipulate a contract to put in the app some products, iโ€™ve 3 kinds of contract with different quantities the customers could insert; for eg, if the customer stipulate a contract with 20 products, i need the โ€œadd buttonโ€ disappears when the customer has inserted his quantities. Than, i tried different solution: iโ€™ve 3 virtual column, 1st with counter, 2nd lookup how many products have customer in his contract, 3rd subtract and if result is โ€œ0โ€ give me N โ€ฆi tried to insert different conditions in behavior but all attempts were in vain

Gotcha. So every time when the customer makes an order, they need to add a record into your products table, correct?

exactly, i tried to insert behavior (INSERTABLE = NO), or a more complex search function if the result from zero but do not work(IF (COUNT (FILTER( โ€ฆ=0) and also [Insertable Column]<=0 (
this is not correct because the counter give the result -1,-2 etc)

How do you identify the user? Does the customer need to sign in?

yesโ€ฆwith USEREMAIL()

I done also the slices view (ROW FILTER CONDITION: USEREMAIL()=[USER])

Does your products and Contracts table contain customerโ€™s email address?

If they do, you could use the formula with the system generated โ€œAddโ€ action button.
COUNT(Products[ID Products],[User]=USEREMAIL()))<LOOKUP(USEREMAIL(),โ€œContractsโ€,โ€œUserโ€,โ€œNumber of products includedโ€)

something is wrongโ€ฆ

1st message parentheses i tried COUNT(Products[ID Products],[User]=USEREMAIL())<LOOKUP(USEREMAIL(),โ€œContractsโ€,โ€œUserโ€,โ€œNumber of products includedโ€)โ€ฆmessage COUNT function is used incorrectly

You should never type a formula from a meetingโ€ฆ

COUNT(SELECT(Products[ID Products],[User]=USEREMAIL()))<LOOKUP(USEREMAIL(),โ€œContractsโ€,โ€œUserโ€,โ€œNumber of products includedโ€)

@Aleksi Tx Aleksi, i modified the rule and now it works, but now iโ€™ve another problem and I make you a summary:

Iโ€™ve a table for PRODUCTS, a table for SERIES, my customers have limitation for PRODUCTS, and SERIES; iโ€™ve anoter table CONTRACTS where i put the limitation (Nยฐ OF INCLUDED PRODUCTS, Nยฐ OF SERIES INCLUDED);

PRODUCTS TABLE:
1.ID PRODUCTS
2.PRODUCT NAME
3.SERIES (REF TABLE SERIES with A PART OF)
โ€ฆ
CONTRACT TABLE:
1.ID CONTRACT
2. Nยฐ PRODUCTS INCLUDED
3. Nยฐ SERIES INCLUDED
4. USER
โ€ฆ

  • i inserted the formula in ADD ACTION for PRODUCT TABLE (COUNT(SELECT(Products[Id Product],[User]=USEREMAIL()))<LOOKUP(USEREMAIL(),โ€œContracts,โ€œUserโ€,โ€œNยฐ products includedโ€) and it works;

  • I inserted the formula in ADD ACTION for SERIES TABLE (COUNT(SELECT(Series[Id Series],[User]=USEREMAIL()))<LOOKUP(USEREMAIL(),โ€œContractsโ€,โ€œUserโ€,โ€œNยฐ series includedโ€) and it works in SERIES VIEW, but when i use add with ref column, the rule doesnโ€™t work. How can i Resolve it?


May I ask where this formula actually is? In actionโ€™s โ€œOnly if this condition is trueโ€ option?

exactly, in the action generate by system
i also tried to insert this rule in tables but it doesnโ€™t work

If I understand your request where you want to remove the โ€œNewโ€ button while filling the form, you need to do that in table level. You can do that with the โ€œAre updates allowed?โ€ option if you add a formula there.

@Aleksi, i tried to insert the same action formula but it doesnโ€™t work, can you help me with this formula?

i also inserted a virtual column INSERTABLE Y/N in PRODUCTS TABLE and i added a formula in โ€œARE UPDATE ALLOWED?โ€ to check [INSERTABOLE]=TRUE in the PRODUCTS TALBLE but also that doesnโ€™t work

@Mark_Pathfinder What is your account ID and table name if I check your app?

@Aleksi id 592176 app AUMMENTHA ARCHITECT table PRODOTTI ARCHITECT

Hi @aleksi did u check it?

@Aleksi hi, can i have a solution for that?

Top Labels in this Space