Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Validation script for portal?


This topic is 7219 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

In order to stop bad user entry into my database, I need to stop more than 40 orders in total being placed. A customer can have 5 orders, 5 "active" orders that are not set to cancel. But basically the user enters the orders via a portal relating to the orders table. I need a way that when they click the Weightneeded which is a popmenu of weights, a way to check that there haven't been 40 orders.

So far i have tried adding a script to the field but i just get loads of problems like the dialog wouldn't show and it wouldn't count correctly, here is the script i was trying to use:


If(OrderCounterSum >=40)

beep

show dialog("Error" etc)

ElseIf

goto field WeightNeeded

Endif

any help would be great grin.gif

Posted

Does you "OrderCounterSum" make the difference between active and non-active orders?? (i.e. you only need to count the active orders if i understand well)

wink.gif

Try to make your TO graph so that it takes into account the difference....

Posted

the orderCounter has a script which is:

If(Cancel?="Yes"; 0 ; 1)

this then is counted by a summary field to get the total which i need to use in the script to check the number of orders and so on.

Posted

You don't need a summary field. A simple calc field = Sum (orderCounter) placed OUTSIDE the portal will suffice. It will total the non-cancelled orders in the portal.

Posted

Upon changing to a calculation and trying to make it work, it doesn't work, thats why i have a summary field, now could somebody go back and read my first post and help me with the script for the portal problem!

Posted

Commit Records/Requests [ ]

If [Count(Orders::serial) = 40]

Show Custom Dialog ["No more orders can be entered."]

Else

Go to Field [Orders::WeightNeeded]

End If

where Orders is the relationship the portal uses.

Posted

Thank You loads, I had only missed of the Commit Records/Requests[], but it would be helpful if you could tell more for the future the importance of that script step?

Posted

Commit Records/Requests posts any changes you may have made to the current record or related records via portal. It is the equivalent of clicking on a non-field portion of a layout.

If you set a key field, for instance, you need to commit the change to be able to refer to the relationship in calcs or script steps. If you create multiple related records via portal, the records will not exist in the system until you commit them.

Overall, it is a good idea to use the commit step at the beginning of any script that does not require referencing a selected related record. In other words, do not use it if you are going to related records from a button in a portal, etc. It should also be used after changing a record via script, if subsequent script steps require the changed information, e.g. a key field for a relationship, be current to process it appropriately. This is most necessary for accurate related information, but may be useful in other areas.

Posted

Er there is a problem with the script, it executes fine in the first field of the portal but doesn't in any of the others. The field is a value list and when you try to select a value in say the second row it doesn't enter the value but changes the first value?

Help!!

--------

EDIT:

Not sure if this is the most effective way but inserted a "go to portal row" step before which is set to last. But hey it works! smile.gif

Posted

Very true, relationship::field refers to the first related field according to the portal's sort order, if you are not already in the portal. If you are in the portal, it refers to the current row's field. So you would have to go to the last row before going to the field.

This topic is 7219 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.