Announcement

Collapse
No announcement yet.

overwriting the last record

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    overwriting the last record



    Hello ,

    This code is overwriting the last record when the custid
    doesn't exist already. The update section works perfectly. So, when
    an existing customer fills the field for saving to this db, and hasn't
    done it yet, it should be in the MvElse section because
    CCCcodes.d.custid is NULL , where it adds the
    record by overwriting the last record in the db.

    Should I MvGo to the end of the db and then add the record? I thought
    MvAdd would do this automatically -- I've obviously missed something
    here -- probably simple too :-) TIA.

    <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
    <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id AND NOT CCCcodes.eof }">
    <MvIf EXPR="CCCcodes.d.custid">
    <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
    <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
    <MvUpdate NAME = "CCCcodes">
    <MvElse>
    <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
    <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
    <MvADD NAME = "CCCcodes">
    </MvIf>
    <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">

    BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
    And there are only 2 fields in the db, custid and ccodes.

    --
    Best regards,
    Scott
    mailto:[email protected]




    #2
    overwriting the last record



    Hi Scott,

    I wonder if the typo in "NOT CCCcodes.eof" could be a problem - I =
    suppose
    that should be NOT CCCcodes.d.eof

    <MvFILTER NAME=3D"CCCcodes" FILTER=3D"{ CCCcodes.d.custid EQ =
    customers.d.id AND
    NOT CCCcodes.--->d.<---eof }">?


    Markus



    -----Original Message-----
    From: [email protected] =
    [mailto:[email protected]]
    On Behalf Of Scott Shepard
    Sent: Dienstag, 8. M=E4rz 2005 01:41
    To: [email protected]
    Subject: [mrc] overwriting the last record

    Hello ,

    This code is overwriting the last record when the custid doesn't exist
    already. The update section works perfectly. So, when an existing =
    customer
    fills the field for saving to this db, and hasn't done it yet, it should =
    be
    in the MvElse section because CCCcodes.d.custid is NULL , where it adds =
    the
    record by overwriting the last record in the db.

    Should I MvGo to the end of the db and then add the record? I thought =
    MvAdd
    would do this automatically -- I've obviously missed something here --
    probably simple too :-) TIA.

    <MvASSIGN NAME =3D "l.ok" VALUE =3D "{ CCC_Open_Store() =
    }">
    <MvFILTER NAME=3D"CCCcodes" FILTER=3D"{ =
    CCCcodes.d.custid EQ
    customers.d.id AND NOT CCCcodes.eof }">
    <MvIf EXPR=3D"CCCcodes.d.custid">
    <MvASSIGN NAME=3D"CCCcodes.d.custid"
    VALUE=3D"{customers.d.id}">
    <MvASSIGN NAME=3D"CCCcodes.d.ccodes"
    VALUE=3D"{g.qvalue}">
    <MvUpdate NAME =3D "CCCcodes">
    <MvElse>
    <MvASSIGN NAME=3D"CCCcodes.d.custid"
    VALUE=3D"{customers.d.id}">
    <MvASSIGN NAME=3D"CCCcodes.d.ccodes"
    VALUE=3D"{g.qvalue}">
    <MvADD NAME =3D "CCCcodes">
    </MvIf>
    <MvASSIGN NAME =3D "l.ok" VALUE =3D "{ CCC_Close_Store() =
    }"> =20

    BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
    And there are only 2 fields in the db, custid and ccodes.

    --
    Best regards,
    Scott =20
    mailto:[email protected]



    Comment


      #3
      overwriting the last record



      Huu, I admit, I didn't read the last 2 lines. Well, it's still a mistake
      which could screw up the filter. Maybe it helps anyway.

      Markus=20

      -----Original Message-----
      From: [email protected] =
      [mailto:[email protected]]
      On Behalf Of Scott Shepard
      Sent: Dienstag, 8. M=E4rz 2005 01:41
      To: [email protected]
      Subject: [mrc] overwriting the last record

      Hello ,

      This code is overwriting the last record when the custid doesn't exist
      already. The update section works perfectly. So, when an existing =
      customer
      fills the field for saving to this db, and hasn't done it yet, it should =
      be
      in the MvElse section because CCCcodes.d.custid is NULL , where it adds =
      the
      record by overwriting the last record in the db.

      Should I MvGo to the end of the db and then add the record? I thought =
      MvAdd
      would do this automatically -- I've obviously missed something here --
      probably simple too :-) TIA.

      <MvASSIGN NAME =3D "l.ok" VALUE =3D "{ CCC_Open_Store() =
      }">
      <MvFILTER NAME=3D"CCCcodes" FILTER=3D"{ =
      CCCcodes.d.custid EQ
      customers.d.id AND NOT CCCcodes.eof }">
      <MvIf EXPR=3D"CCCcodes.d.custid">
      <MvASSIGN NAME=3D"CCCcodes.d.custid"
      VALUE=3D"{customers.d.id}">
      <MvASSIGN NAME=3D"CCCcodes.d.ccodes"
      VALUE=3D"{g.qvalue}">
      <MvUpdate NAME =3D "CCCcodes">
      <MvElse>
      <MvASSIGN NAME=3D"CCCcodes.d.custid"
      VALUE=3D"{customers.d.id}">
      <MvASSIGN NAME=3D"CCCcodes.d.ccodes"
      VALUE=3D"{g.qvalue}">
      <MvADD NAME =3D "CCCcodes">
      </MvIf>
      <MvASSIGN NAME =3D "l.ok" VALUE =3D "{ CCC_Close_Store() =
      }"> =20

      BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
      And there are only 2 fields in the db, custid and ccodes.

      --
      Best regards,
      Scott =20
      mailto:[email protected]



      Comment


        #4
        Re[2]: overwriting the last record



        I fixed the typo -- thanks. It didn't solve the problem.

        Does it look like this logic should work?

        TIA,

        Scott
        IDS


        Monday, March 7, 2005, 4:42:56 PM, you wrote:

        M> Huu, I admit, I didn't read the last 2 lines. Well, it's still a mistake
        M> which could screw up the filter. Maybe it helps anyway.

        M> Markus

        M> -----Original Message-----
        M> From: [email protected] [mailto:[email protected]]
        M> On Behalf Of Scott Shepard
        M> Sent: Dienstag, 8. März 2005 01:41
        M> To: [email protected]
        M> Subject: [mrc] overwriting the last record

        M> Hello ,

        M> This code is overwriting the last record when the custid doesn't exist
        M> already. The update section works perfectly. So, when an existing customer
        M> fills the field for saving to this db, and hasn't done it yet, it should be
        M> in the MvElse section because CCCcodes.d.custid is NULL , where it adds the
        M> record by overwriting the last record in the db.

        M> Should I MvGo to the end of the db and then add the record? I thought MvAdd
        M> would do this automatically -- I've obviously missed something here --
        M> probably simple too :-) TIA.

        M> <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
        M> <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ
        M> customers.d.id AND NOT CCCcodes.eof }">
        M> <MvIf EXPR="CCCcodes.d.custid">
        M> <MvASSIGN NAME="CCCcodes.d.custid"
        M> VALUE="{customers.d.id}">
        M> <MvASSIGN NAME="CCCcodes.d.ccodes"
        VALUE="{g.qvalue}">>
        M> <MvUpdate NAME = "CCCcodes">
        M> <MvElse>
        M> <MvASSIGN NAME="CCCcodes.d.custid"
        M> VALUE="{customers.d.id}">
        M> <MvASSIGN NAME="CCCcodes.d.ccodes"
        VALUE="{g.qvalue}">>
        M> <MvADD NAME = "CCCcodes">
        M> </MvIf>
        M> <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">

        M> BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
        M> And there are only 2 fields in the db, custid and ccodes.

        M> --
        M> Best regards,
        M> Scott
        M> mailto:[email protected]



        Comment


          #5
          overwriting the last record



          --------------060709060504000004040808
          Content-Type: text/plain; charset=us-ascii; format=flowed
          Content-Transfer-Encoding: 7bit

          How about something like:

          <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
          <MvFIND NAME = "CCCcodes" VALUE = "{ customers.d.id }">
          <MvIF EXPR = "{ NOT CCCcodes.d.EOF }">

          <mvcomment> Record found : Update </mvcomment>

          <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
          <MvUPDATE NAME = "CCCcodes">

          <MvELSE>

          <mvcomment> Record NOT found : Add </mvcomment>

          <MvASSIGN NAME = "CCCcodes.d.custid" VALUE = "{ customers.d.id }">
          <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
          <MvADD NAME = "CCCcodes">

          </MvIF>
          <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">


          Scott
          SEBENZA.COM
          Miva Development

          Web: <A HREF ="http://www.sebenza.com">http://www.sebenza.com</A>
          <A HREF ="http://www.mvcool.com/SS - miva modules">http://www.mvcool.com/SS - miva modules</A>



          Scott Shepard wrote:

          >Hello ,
          >
          >This code is overwriting the last record when the custid
          >doesn't exist already. The update section works perfectly. So, when
          >an existing customer fills the field for saving to this db, and hasn't
          >done it yet, it should be in the MvElse section because
          >CCCcodes.d.custid is NULL , where it adds the
          >record by overwriting the last record in the db.
          >
          >Should I MvGo to the end of the db and then add the record? I thought
          >MvAdd would do this automatically -- I've obviously missed something
          >here -- probably simple too :-) TIA.
          >
          > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
          > <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id AND NOT CCCcodes.eof }">
          > <MvIf EXPR="CCCcodes.d.custid">
          > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
          > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
          > <MvUpdate NAME = "CCCcodes">
          > <MvElse>
          > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
          > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
          > <MvADD NAME = "CCCcodes">
          > </MvIf>
          > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
          >
          >BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
          >And there are only 2 fields in the db, custid and ccodes.
          >
          >
          >

          --------------060709060504000004040808--

          Comment


            #6
            overwriting the last record



            Or, just to keep from repeating yourself...

            <MvASSIGN NAME="l.ok" VALUE="{CCC_Open_Store()}">
            <MvFIND NAME="CCCcodes" VALUE="{Customers.d.id}">
            <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
            <MvIF EXPR="{NOT CCCcodes.d.EOF}">
            <MvUPDATE NAME="CCCcodes">
            <MvELSE>
            <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
            <MvADD NAME="CCCcodes">
            </MvIF>
            <MvASSIGN NAME="l.ok" VALUE="{CCC_Close_Store()}">



            On Tue, 08 Mar 2005 10:12:35 -0700, Sebenza Lists <[email protected]> wrote:
            > How about something like:
            >
            > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
            > <MvFIND NAME = "CCCcodes" VALUE = "{ customers.d.id }">
            > <MvIF EXPR = "{ NOT CCCcodes.d.EOF }">
            >
            > <mvcomment> Record found : Update </mvcomment>
            >
            > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
            > <MvUPDATE NAME = "CCCcodes">
            >
            > <MvELSE>
            >
            > <mvcomment> Record NOT found : Add </mvcomment>
            >
            > <MvASSIGN NAME = "CCCcodes.d.custid" VALUE = "{ customers.d.id }">
            > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
            > <MvADD NAME = "CCCcodes">
            >
            > </MvIF>
            > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
            >
            > Scott
            > SEBENZA.COM
            > Miva Development
            >
            > Web: <A HREF ="http://www.sebenza.com">http://www.sebenza.com</A>
            > <A HREF ="http://www.mvcool.com/SS - miva modules">http://www.mvcool.com/SS - miva modules</A>
            >
            >
            > Scott Shepard wrote:
            >
            > >Hello ,
            > >
            > >This code is overwriting the last record when the custid
            > >doesn't exist already. The update section works perfectly. So, when
            > >an existing customer fills the field for saving to this db, and hasn't
            > >done it yet, it should be in the MvElse section because
            > >CCCcodes.d.custid is NULL , where it adds the
            > >record by overwriting the last record in the db.
            > >
            > >Should I MvGo to the end of the db and then add the record? I thought
            > >MvAdd would do this automatically -- I've obviously missed something
            > >here -- probably simple too :-) TIA.
            > >
            > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
            > > <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id AND NOT CCCcodes.eof }">
            > > <MvIf EXPR="CCCcodes.d.custid">
            > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
            > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
            > > <MvUpdate NAME = "CCCcodes">
            > > <MvElse>
            > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
            > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
            > > <MvADD NAME = "CCCcodes">
            > > </MvIf>
            > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
            > >
            > >BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
            > >And there are only 2 fields in the db, custid and ccodes.
            > >
            > >
            > >
            >
            >


            --
            -Brian
            Burns Enterprises

            Comment


              #7
              overwriting the last record



              And, actually, the assign for the ADD should be a new ID, not customers.d.id

              On Tue, 8 Mar 2005 12:50:02 -0500, Brian (Burns Enterprises)
              <[email protected]> wrote:
              > Or, just to keep from repeating yourself...
              >
              > <MvASSIGN NAME="l.ok" VALUE="{CCC_Open_Store()}">
              > <MvFIND NAME="CCCcodes" VALUE="{Customers.d.id}">
              > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
              > <MvIF EXPR="{NOT CCCcodes.d.EOF}">
              > <MvUPDATE NAME="CCCcodes">
              > <MvELSE>
              > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
              > <MvADD NAME="CCCcodes">
              > </MvIF>
              > <MvASSIGN NAME="l.ok" VALUE="{CCC_Close_Store()}">
              >
              > On Tue, 08 Mar 2005 10:12:35 -0700, Sebenza Lists <[email protected]> wrote:
              > > How about something like:
              > >
              > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
              > > <MvFIND NAME = "CCCcodes" VALUE = "{ customers.d.id }">
              > > <MvIF EXPR = "{ NOT CCCcodes.d.EOF }">
              > >
              > > <mvcomment> Record found : Update </mvcomment>
              > >
              > > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
              > > <MvUPDATE NAME = "CCCcodes">
              > >
              > > <MvELSE>
              > >
              > > <mvcomment> Record NOT found : Add </mvcomment>
              > >
              > > <MvASSIGN NAME = "CCCcodes.d.custid" VALUE = "{ customers.d.id }">
              > > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
              > > <MvADD NAME = "CCCcodes">
              > >
              > > </MvIF>
              > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
              > >
              > > Scott
              > > SEBENZA.COM
              > > Miva Development
              > >
              > > Web: <A HREF ="http://www.sebenza.com">http://www.sebenza.com</A>
              > > <A HREF ="http://www.mvcool.com/SS - miva modules">http://www.mvcool.com/SS - miva modules</A>
              > >
              > >
              > > Scott Shepard wrote:
              > >
              > > >Hello ,
              > > >
              > > >This code is overwriting the last record when the custid
              > > >doesn't exist already. The update section works perfectly. So, when
              > > >an existing customer fills the field for saving to this db, and hasn't
              > > >done it yet, it should be in the MvElse section because
              > > >CCCcodes.d.custid is NULL , where it adds the
              > > >record by overwriting the last record in the db.
              > > >
              > > >Should I MvGo to the end of the db and then add the record? I thought
              > > >MvAdd would do this automatically -- I've obviously missed something
              > > >here -- probably simple too :-) TIA.
              > > >
              > > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
              > > > <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id AND NOT CCCcodes.eof }">
              > > > <MvIf EXPR="CCCcodes.d.custid">
              > > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
              > > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
              > > > <MvUpdate NAME = "CCCcodes">
              > > > <MvElse>
              > > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
              > > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
              > > > <MvADD NAME = "CCCcodes">
              > > > </MvIf>
              > > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
              > > >
              > > >BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
              > > >And there are only 2 fields in the db, custid and ccodes.
              > > >
              > > >
              > > >
              > >
              > >
              >
              > --
              > -Brian
              > Burns Enterprises
              >


              --
              -Brian
              Burns Enterprises

              Comment


                #8
                overwriting the last record



                --------------050809030608020109010505
                Content-Type: text/plain; charset=us-ascii; format=flowed
                Content-Transfer-Encoding: 7bit

                Yep... your right. Overlooked that one.

                Scott

                Scott
                SEBENZA.COM
                Miva Development

                Web: <A HREF ="http://www.sebenza.com">http://www.sebenza.com</A>
                <A HREF ="http://www.mvcool.com/SS - miva modules">http://www.mvcool.com/SS - miva modules</A>



                Brian (Burns Enterprises) wrote:

                >And, actually, the assign for the ADD should be a new ID, not customers.d.id
                >
                >On Tue, 8 Mar 2005 12:50:02 -0500, Brian (Burns Enterprises)
                ><[email protected]> wrote:
                >
                >
                >>Or, just to keep from repeating yourself...
                >>
                >><MvASSIGN NAME="l.ok" VALUE="{CCC_Open_Store()}">
                >><MvFIND NAME="CCCcodes" VALUE="{Customers.d.id}">
                >><MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                >><MvIF EXPR="{NOT CCCcodes.d.EOF}">
                >> <MvUPDATE NAME="CCCcodes">
                >><MvELSE>
                >> <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                >> <MvADD NAME="CCCcodes">
                >></MvIF>
                >><MvASSIGN NAME="l.ok" VALUE="{CCC_Close_Store()}">
                >>
                >>On Tue, 08 Mar 2005 10:12:35 -0700, Sebenza Lists <[email protected]> wrote:
                >>
                >>
                >>>How about something like:
                >>>
                >>><MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
                >>><MvFIND NAME = "CCCcodes" VALUE = "{ customers.d.id }">
                >>><MvIF EXPR = "{ NOT CCCcodes.d.EOF }">
                >>>
                >>> <mvcomment> Record found : Update </mvcomment>
                >>>
                >>> <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
                >>> <MvUPDATE NAME = "CCCcodes">
                >>>
                >>><MvELSE>
                >>>
                >>> <mvcomment> Record NOT found : Add </mvcomment>
                >>>
                >>> <MvASSIGN NAME = "CCCcodes.d.custid" VALUE = "{ customers.d.id }">
                >>> <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
                >>> <MvADD NAME = "CCCcodes">
                >>>
                >>></MvIF>
                >>><MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
                >>>
                >>>Scott
                >>>SEBENZA.COM
                >>>Miva Development
                >>>
                >>>Web: <A HREF ="http://www.sebenza.com">http://www.sebenza.com</A>
                >>><A HREF ="http://www.mvcool.com/SS - miva modules">http://www.mvcool.com/SS - miva modules</A>
                >>>
                >>>
                >>>Scott Shepard wrote:
                >>>
                >>>
                >>>
                >>>>Hello ,
                >>>>
                >>>>This code is overwriting the last record when the custid
                >>>>doesn't exist already. The update section works perfectly. So, when
                >>>>an existing customer fills the field for saving to this db, and hasn't
                >>>>done it yet, it should be in the MvElse section because
                >>>>CCCcodes.d.custid is NULL , where it adds the
                >>>>record by overwriting the last record in the db.
                >>>>
                >>>>Should I MvGo to the end of the db and then add the record? I thought
                >>>>MvAdd would do this automatically -- I've obviously missed something
                >>>>here -- probably simple too :-) TIA.
                >>>>
                >>>> <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
                >>>> <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id AND NOT CCCcodes.eof }">
                >>>> <MvIf EXPR="CCCcodes.d.custid">
                >>>> <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                >>>> <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                >>>> <MvUpdate NAME = "CCCcodes">
                >>>> <MvElse>
                >>>> <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                >>>> <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                >>>> <MvADD NAME = "CCCcodes">
                >>>> </MvIf>
                >>>> <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
                >>>>
                >>>>BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
                >>>>And there are only 2 fields in the db, custid and ccodes.
                >>>>
                >>>>
                >>>>
                >>>>
                >>>>
                >>>
                >>>
                >>--
                >>-Brian
                >>Burns Enterprises
                >>
                >>
                >>
                >
                >
                >
                >

                --------------050809030608020109010505--

                Comment


                  #9
                  Re[2]: overwriting the last record



                  Hello Brian,

                  Curious, what do you mean "new ID?" This db is meant to be an
                  extention of the customers db. I am keeping them separate; so the
                  customers.d.id needs to match in both dbs.

                  Also, this example assumes indexes are used. I haven't done that yet.
                  I'll try it though. This logic doesn't look any different than what
                  I've done using MvFilter -- at least last night it didn't. :-)

                  Thanks,

                  Scott
                  IDS

                  Tuesday, March 8, 2005, 9:53:10 AM, you wrote:

                  BBE> And, actually, the assign for the ADD should be a new ID, not customers.d.id

                  BBE> On Tue, 8 Mar 2005 12:50:02 -0500, Brian (Burns Enterprises)
                  BBE> <[email protected]> wrote:
                  >> Or, just to keep from repeating yourself...
                  >>
                  >> <MvASSIGN NAME="l.ok" VALUE="{CCC_Open_Store()}">
                  >> <MvFIND NAME="CCCcodes" VALUE="{Customers.d.id}">
                  >> <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                  >> <MvIF EXPR="{NOT CCCcodes.d.EOF}">
                  >> <MvUPDATE NAME="CCCcodes">
                  >> <MvELSE>
                  >> <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                  >> <MvADD NAME="CCCcodes">
                  >> </MvIF>
                  >> <MvASSIGN NAME="l.ok" VALUE="{CCC_Close_Store()}">
                  >>
                  >> On Tue, 08 Mar 2005 10:12:35 -0700, Sebenza Lists <[email protected]> wrote:
                  >> > How about something like:
                  >> >
                  >> > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
                  >> > <MvFIND NAME = "CCCcodes" VALUE = "{ customers.d.id }">
                  >> > <MvIF EXPR = "{ NOT CCCcodes.d.EOF }">
                  >> >
                  >> > <mvcomment> Record found : Update </mvcomment>
                  >> >
                  >> > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
                  >> > <MvUPDATE NAME = "CCCcodes">
                  >> >
                  >> > <MvELSE>
                  >> >
                  >> > <mvcomment> Record NOT found : Add </mvcomment>
                  >> >
                  >> > <MvASSIGN NAME = "CCCcodes.d.custid" VALUE = "{ customers.d.id }">
                  >> > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
                  >> > <MvADD NAME = "CCCcodes">
                  >> >
                  >> > </MvIF>
                  >> > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
                  >> >
                  >> > Scott
                  >> > SEBENZA.COM
                  >> > Miva Development
                  >> >
                  >> > Web: <A HREF ="http://www.sebenza.com">http://www.sebenza.com</A>
                  >> > <A HREF ="http://www.mvcool.com/SS - miva modules">http://www.mvcool.com/SS - miva modules</A>
                  >> >
                  >> >
                  >> > Scott Shepard wrote:
                  >> >
                  >> > >Hello ,
                  >> > >
                  >> > >This code is overwriting the last record when the custid
                  >> > >doesn't exist already. The update section works perfectly. So, when
                  >> > >an existing customer fills the field for saving to this db, and hasn't
                  >> > >done it yet, it should be in the MvElse section because
                  >> > >CCCcodes.d.custid is NULL , where it adds the
                  >> > >record by overwriting the last record in the db.
                  >> > >
                  >> > >Should I MvGo to the end of the db and then add the record? I thought
                  >> > >MvAdd would do this automatically -- I've obviously missed something
                  >> > >here -- probably simple too :-) TIA.
                  >> > >
                  >> > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
                  >> > > <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id AND NOT CCCcodes.eof }">
                  >> > > <MvIf EXPR="CCCcodes.d.custid">
                  >> > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                  >> > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                  >> > > <MvUpdate NAME = "CCCcodes">
                  >> > > <MvElse>
                  >> > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                  >> > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                  >> > > <MvADD NAME = "CCCcodes">
                  >> > > </MvIf>
                  >> > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
                  >> > >
                  >> > >BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
                  >> > >And there are only 2 fields in the db, custid and ccodes.
                  >> > >
                  >> > >
                  >> > >
                  >> >
                  >> >
                  >>
                  >> --
                  >> -Brian
                  >> Burns Enterprises
                  >>





                  --
                  Best regards,
                  Scott
                  mailto:[email protected]



                  Comment


                    #10
                    Re[3]: overwriting the last record



                    Thanks for your code snippets. Gave me an idea what might be wrong
                    with my code. Turned out it was an easy one after
                    all. The following code works perfectly.

                    <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id }">
                    <MvIf EXPR="{ NOT CCCcodes.d.eof }">
                    <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                    <MvUpdate NAME = "CCCcodes">
                    <MvElse>
                    <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                    <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                    <MvADD NAME = "CCCcodes">
                    </MvIf>

                    Thanks,

                    Scott
                    IDS

                    Tuesday, March 8, 2005, 1:58:29 PM, you wrote:

                    SS> Hello Brian,

                    SS> Curious, what do you mean "new ID?" This db is meant to be an
                    SS> extention of the customers db. I am keeping them separate; so the
                    SS> customers.d.id needs to match in both dbs.

                    SS> Also, this example assumes indexes are used. I haven't done that yet.
                    SS> I'll try it though. This logic doesn't look any different than what
                    SS> I've done using MvFilter -- at least last night it didn't. :-)

                    SS> Thanks,

                    SS> Scott
                    SS> IDS

                    SS> Tuesday, March 8, 2005, 9:53:10 AM, you wrote:

                    BBE>> And, actually, the assign for the ADD should be a new ID, not customers.d.id

                    BBE>> On Tue, 8 Mar 2005 12:50:02 -0500, Brian (Burns Enterprises)
                    BBE>> <[email protected]> wrote:
                    >>> Or, just to keep from repeating yourself...
                    >>>
                    >>> <MvASSIGN NAME="l.ok" VALUE="{CCC_Open_Store()}">
                    >>> <MvFIND NAME="CCCcodes" VALUE="{Customers.d.id}">
                    >>> <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                    >>> <MvIF EXPR="{NOT CCCcodes.d.EOF}">
                    >>> <MvUPDATE NAME="CCCcodes">
                    >>> <MvELSE>
                    >>> <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                    >>> <MvADD NAME="CCCcodes">
                    >>> </MvIF>
                    >>> <MvASSIGN NAME="l.ok" VALUE="{CCC_Close_Store()}">
                    >>>
                    >>> On Tue, 08 Mar 2005 10:12:35 -0700, Sebenza Lists <[email protected]> wrote:
                    >>> > How about something like:
                    >>> >
                    >>> > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
                    >>> > <MvFIND NAME = "CCCcodes" VALUE = "{ customers.d.id }">
                    >>> > <MvIF EXPR = "{ NOT CCCcodes.d.EOF }">
                    >>> >
                    >>> > <mvcomment> Record found : Update </mvcomment>
                    >>> >
                    >>> > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
                    >>> > <MvUPDATE NAME = "CCCcodes">
                    >>> >
                    >>> > <MvELSE>
                    >>> >
                    >>> > <mvcomment> Record NOT found : Add </mvcomment>
                    >>> >
                    >>> > <MvASSIGN NAME = "CCCcodes.d.custid" VALUE = "{ customers.d.id }">
                    >>> > <MvASSIGN NAME = "CCCcodes.d.ccodes" VALUE = "{ g.qvalue }">
                    >>> > <MvADD NAME = "CCCcodes">
                    >>> >
                    >>> > </MvIF>
                    >>> > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
                    >>> >
                    >>> > Scott
                    >>> > SEBENZA.COM
                    >>> > Miva Development
                    >>> >
                    >>> > Web: <A HREF ="http://www.sebenza.com">http://www.sebenza.com</A>
                    >>> > <A HREF ="http://www.mvcool.com/SS - miva modules">http://www.mvcool.com/SS - miva modules</A>
                    >>> >
                    >>> >
                    >>> > Scott Shepard wrote:
                    >>> >
                    >>> > >Hello ,
                    >>> > >
                    >>> > >This code is overwriting the last record when the custid
                    >>> > >doesn't exist already. The update section works perfectly. So, when
                    >>> > >an existing customer fills the field for saving to this db, and hasn't
                    >>> > >done it yet, it should be in the MvElse section because
                    >>> > >CCCcodes.d.custid is NULL , where it adds the
                    >>> > >record by overwriting the last record in the db.
                    >>> > >
                    >>> > >Should I MvGo to the end of the db and then add the record? I thought
                    >>> > >MvAdd would do this automatically -- I've obviously missed something
                    >>> > >here -- probably simple too :-) TIA.
                    >>> > >
                    >>> > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Open_Store() }">
                    >>> > > <MvFILTER NAME="CCCcodes" FILTER="{ CCCcodes.d.custid EQ customers.d.id AND NOT CCCcodes.eof }">
                    >>> > > <MvIf EXPR="CCCcodes.d.custid">
                    >>> > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                    >>> > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                    >>> > > <MvUpdate NAME = "CCCcodes">
                    >>> > > <MvElse>
                    >>> > > <MvASSIGN NAME="CCCcodes.d.custid" VALUE="{customers.d.id}">
                    >>> > > <MvASSIGN NAME="CCCcodes.d.ccodes" VALUE="{g.qvalue}">
                    >>> > > <MvADD NAME = "CCCcodes">
                    >>> > > </MvIf>
                    >>> > > <MvASSIGN NAME = "l.ok" VALUE = "{ CCC_Close_Store() }">
                    >>> > >
                    >>> > >BTW: works the same with or without "NOT CCCcodes.eof" in the filter.
                    >>> > >And there are only 2 fields in the db, custid and ccodes.
                    >>> > >
                    >>> > >
                    >>> > >
                    >>> >
                    >>> >
                    >>>
                    >>> --
                    >>> -Brian
                    >>> Burns Enterprises
                    >>>








                    --
                    Best regards,
                    Scott
                    mailto:[email protected]



                    Comment

                    Working...
                    X