Jump to content

Validation script for portal?


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

Recommended Posts


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)


show dialog("Error" etc)


goto field WeightNeeded


any help would be great grin.gif

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Commit Records/Requests [ ]

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

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


Go to Field [Orders::WeightNeeded]

End If

where Orders is the relationship the portal uses.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?




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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 6608 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.