3 Replies Latest reply on Apr 12, 2015 9:17 AM by philmodjunk

    Just want to add single data entry

    ChristopherRau

      Title

      Just want to add single data entry

      Post

      Hi,

      I have a new view where I can enter the master data from a company, this data should later print on invoice.

      But how can I prevent to add more then one entry? I want just add the first entry, and this should be editable.

      Thanks

      Regards Christopher.

        • 1. Re: Just want to add single data entry
          philmodjunk

          What do you mean by "prevent add more than one entry"?

          Are you trying to keep the user from adding/selecting more than one item in a field?

          Are you trying to keep the user from adding a record for a company if it has already been entered?

          Or something else?

          • 2. Re: Just want to add single data entry
            ChristopherRau

            Are you trying to keep the user from adding a record for a company if it has already been entered?

            This is the correct question what I mean.

            First time the customer enters the view the fields are all empty, then the customer fills out the company data. After this, the customer should not be able to add a new record, the costumer should be able to edit the company data.

            • 3. Re: Just want to add single data entry
              philmodjunk

              Use Fields with Global storage enabled for the user to enter their company data. Have a script perform a find to see if there is a record with this data already in your table. If no record is found, I'd then have the system show a dialog asking if they want to create a new record. (The user may have mistyped some info and may instead want to correct the error instead of creating a new record. If the user click OK in the custom dialog asking if they want a new record, the script creates a new record and uses set field steps to transfer the data into the fields of the new record.

              Here's an outline using a single global field. The same process works for multiple fields, you just need more set field steps where you find only one in this example:

              #Go to layout step is not needed if script always starts from a layout base on Companies
              Go to Layout ["Companies" (Companies) ]
              Enter Find Mode [] --> clear the pause check box
              Set Field [Companies::CompanyName ; "==" & Globals::gCompanyName ]  
              Set Error Capture [on]
              Perform Find []
              If [ Get ( FoundCount ) = 0 // no company record found ]
                 Show Custom Dialog ["No company named " & Quote ( Globals::gCompanyName ) & " was found. Create a new company record?" ]
                  If [ Get ( LastMessageChoice ) = 1 // OK was clicked ]
                     New Record/Request
                     Set Field [ Companies::CompanyName ; Globals::gCompanyName ]
                  End If
              End If

              This script for finding records is patterned after the examples found here: Scripted Find Examples