You are viewing limited content. For full access, please sign in.

Question

Question

Max Value in table

asked on December 3, 2020

I have a table getting the value from lookup, in one of them the user should enter a numeric value, how to set max and min value in the numeric column depending on another column in the same table 

0 0

Answer

SELECTED ANSWER
replied on December 7, 2020 Show version history

you will always know how many loops you will do because the number of TR's and find that you use to specify the specific column in that table will be specific to the look up rule values generated. 

 

like table A .. look up generated 10 rows... 

 

when you do your onlookupcompleted or onlookupcomplete onlookupfinished

https://answers.laserfiche.com/questions/181863/How-to-use-the-javascript-lookupcoplete-events **** good copy of sample code

 

you want to iterate thru table A and find column value for max purchase and then do you logic. 

 

Multiple tables doesn't matter because your code will find the speicic class you want to iterate through. 

 

TIPS::: Run through the code step by step.. and make sure that you are iterating through the form at the correct time. 

 

post code if doenst work. 

0 0

Replies

replied on December 3, 2020

are you talking about creating a limit in the column value of a look up table?  or you talking about the user input of a table in laserfiche forms .. a particular user input column value needs to have a min max?

0 0
replied on December 3, 2020 Show version history

if you talking about the table in laserfiche forms then you should be able to select the column value option button so that you can add like min max and variable name etc .. heres an image of what it would look 

Screen Shot 2020-12-03 at 2.15.47 AM.png
0 0
replied on December 3, 2020 Show version history

i need to add min and max  dynamically depending on the value from other columns

 

ex:

i have a column with maximum purchase  of 70 items, the user will fill another column how many items you can request, but it shouldn't exceed max value

0 0
replied on December 3, 2020

so that means you have some logic to get the min and max values? 

 

are they coming from look up as well? 

 

0 0
replied on December 3, 2020 Show version history

the column with maximum purchase allowed from the lookup.

0 0
replied on December 3, 2020 Show version history

okay i would add another column value you and call it max purchase .. hide the value .. use the fx function of the Number value in advanced and you should be able to reference the column value max purchase.. use some math logic that im sure you can figure out to make it so that if its over your max value you will give it 0

**make sure to save the data 

 

so each user input number value will output a function  using max purchase value to add a character that will create an error.. you can add some javascript logic to tell user hey you cant add this value because its over the max purchase limit of this column. 

 

i think user value mod max purchase output value to do what you want

 

0 0
replied on December 3, 2020

make sense?

0 0
replied on December 3, 2020

it makes sense, but there is nothing out of the box to add the max and min as variables or formulas.

 

1 0
replied on December 3, 2020

you mean you can't reference the min max value that you populate to a hidden field aka the new column value called max purchase? 

 

I think you should be able to reference that particular column value from the FX of the user input column value 

replied on December 3, 2020

yeah .. would be nice tho but probably not a lot of users need that 

0 0
replied on December 3, 2020

Without using JS, you could add a hidden field that could have a formula to see if the value entered was greater than the Max value from the lookup, using that to trigger a rule to show a custom HTML Field (Value is out of range).

We went down the JS route and created a Popup and hide the Submit button until the values were fixed. Ours wasn't in a table but same concept.

1 0
replied on December 5, 2020

if I did the same for the table getting data from lookup I have to go through each row and add a condition with JS, and this is in case I know how many rows will be returned from DB. 

or loop it with row count to add a condition with JS. and this is only for one table what if my form has multiple tables. I think I'll do it that way for now. 

0 0
SELECTED ANSWER
replied on December 7, 2020 Show version history

you will always know how many loops you will do because the number of TR's and find that you use to specify the specific column in that table will be specific to the look up rule values generated. 

 

like table A .. look up generated 10 rows... 

 

when you do your onlookupcompleted or onlookupcomplete onlookupfinished

https://answers.laserfiche.com/questions/181863/How-to-use-the-javascript-lookupcoplete-events **** good copy of sample code

 

you want to iterate thru table A and find column value for max purchase and then do you logic. 

 

Multiple tables doesn't matter because your code will find the speicic class you want to iterate through. 

 

TIPS::: Run through the code step by step.. and make sure that you are iterating through the form at the correct time. 

 

post code if doenst work. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.