2 Replies Latest reply on Mar 21, 2017 6:19 PM by jiang_aq

    How to script this?


      I have two fields:




      I wanna validate both of them when inputting, for example:

      if qty=3, when I input SeatNo. as "3A4B5C" or "3A 4B 5C" or "3A,4B,5C" , it is passed.

      if qty=3, when I input SeatNo. as "3A4B5C6D" or "3A 4B 5C 6D" or "3A,4B,5C,6D"it is failed, because there are 4 seats No.


      vice versa:

      if SeatNo is  "3A4B5C6D" or "3A 4B 5C 6D" or "3A,4B,5C,6D", when I modify qty=3, it should be failed, show error messagebox.


      How can I do it?

        • 1. Re: How to script this?

          Don't do it that way at all. It is better to prevent the error from taking place than to try to catch and correct it after it has happened.


          You should use some type of point and click interface for selecting the seats that does not require typing in the IDs for each seat. You need either a seating chart of available seats to click or some other interface where you select available and adjacent seats from a list. Either way, the system enters the data for you and putting it all in one field is not ideal either. A set of related records like line items in an invoice would most always be a better approach.


          That said


          Length ( Filter ( YourTable::YourField ; "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) * 2 = YourTable::QtyField


          Will only evaluate as True if the number of two character seat IDs matches the specified quantity.

          But note that I have assumed two character seat IDs. If seat IDs can be 3 characters: 15E or 99A, then this won't work.

          • 2. Re: How to script this?

            should be Length ( Filter ( YourTable::YourField ; "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) / 2 = YourTable::QtyField?


            You inspired me a lot, thank you so much, it works now!