baseportal
Start

baseportal message board

Welcome to the baseportal message board...

Please read the FAQ.

 
 Selected message: To the list 
    Message from xfce on 5/7 2010, 18:49 +00:00

    Re: Unique fields


       <!-- verify serial is unique -->
      <perl>
      if ($cmd eq "add")
      {
       get "Serial==$_put{Serial}", "Inspection";
       if ($_amount_query > 0)
       {
       $cmd="";
       out "Serial Number Already Exists";
       }
       }

       </perl>


       <do action=input>
      <do action=list listtype=add spacing=0 listfields=Serial,Model>

    Your reply:

    Name: EMail: WWW:
    Subject:
    Text:
    Timezone:

    Post a new message


 All messages from this thread: To the list 
    Message from Lucas on 4/27 2010, 15:20 -06:00
    EMail: lparuch@ritehite.com

    Unique fields


      How can I make a field unique?
      I want a user to enter a unique serial number. If a record already exists for that number, I don't want a new record created.
      Another approach, can I change the ID field number to be a unique number of my choosing instead of a sequentially assigned number?
      Thanks!
     Post a reply

    Message from Claus on 4/28 2010, 10:46 +01:00

    Re: Unique fields


      <perl>
      if ($cmd eq "add")
      {
      get "fieldname==$_put{fieldname}, "yourdatabase";
      if ($_amount_query > 0)
      {
      $cmd="";
      out "yor message (entry existing or what ever you want)!";
      }
      }
      </perl>

      <do action=all .....parameter>

      hth

      Greetings

      Claus

     Post a reply

    Message from xfce on 4/28 2010, 11:34 +00:00

    Re: Unique fields


      Unfortunately this no way to make the field unique.

      Its a workaround which only will work with the template it ist built in.

       >... can I change the ID field number to be a unique number of my choosing

      No.
     Post a reply

    Message from Claus on 4/28 2010, 15:22 +01:00

    Re: Unique fields


      a german adage means:

      "better a Sparrow in your hand, than a dove on the roof"...;)

      Free translation...

      Greetings

      Claus
     Post a reply

    Message from xfce on 4/28 2010, 14:54 +00:00

    Re: Unique fields


      Can't see any sparrow. If you need a safe unique reference your approach is incomplete.

      In addition their is no solution in your posting to secure the unique reference in case of editing a record. The questioner should know this.
     Post a reply


    Message from xfce on 4/28 2010, 15:53 +00:00

    Re: Unique fields


      ?
      Strange context!
     Post a reply

    Message from Lucas on 5/7 2010, 10:35 -06:00
    EMail: lparuch@ritehite.com

    Re: Unique fields


      I'm not very familiar with Perl or variables...
      How am I supposed to use the code you suggested?
      This is what I have:
      Thanks!
      Lucas



      <do action=input>

      <do action=list listtype=add spacing=0
      listfields=Serial,Model>

      <!-- verify serial is unique -->
      <perl>
      if ($cmd eq "add")
      {
      get "Serial==$_put{Serial}", "Inspection";
      if ($_amount_query > 0)
      {
      $cmd="";
      out "Serial Number Already Exists";
      }
      }
      </perl>

     Post a reply

    Message from xfce on 5/7 2010, 18:49 +00:00

    Re: Unique fields


       <!-- verify serial is unique -->
      <perl>
      if ($cmd eq "add")
      {
       get "Serial==$_put{Serial}", "Inspection";
       if ($_amount_query > 0)
       {
       $cmd="";
       out "Serial Number Already Exists";
       }
       }

       </perl>


       <do action=input>
      <do action=list listtype=add spacing=0 listfields=Serial,Model>

     Post a reply


    Message from Lucas on 5/7 2010, 12:57 -06:00

    Re: Unique fields


      Thanks. That displays the message correctly, but still adds the duplicate record to the database.
     Post a reply

    Message from Claus on 5/8 2010, 07:39 +01:00

    Re: Unique fields


      if ($cmd eq "add")
      {
      get "Serial==$_put{Serial}", "Inspection";
      if ($_amount_query > 0)
       {
       $cmd="";
       out "Serial Number Already Exists";
       }
       }

       </perl>


       <do action=input cmd=$cmd>
      <do action=list cmd=$cmd listtype=add spacing=0 listfields=Serial,Model>

      ;)

      hth

      Greetings

      Claus

     Post a reply
     
 Messages from 300 to 450: To the input form 
<< Newest messages | < Newer messages | To the input form | Older messages > | Oldest messages >>


Back to the homepage

© baseportal.com. All rights reserved. Terms of use



baseportal.com