Replace command in FoxPro


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 11 of 11

Thread: Replace command in FoxPro

  1. #1
    Richard Linhart Guest

    Replace command in FoxPro


    Does anyone know how it would be possible to return the number of rows affected
    by the Foxpro Replace command? For example:

    Replace Field1 with 'X' all for Field2='Y'



  2. #2
    Cindy Winegarden Guest

    Re: Replace command in FoxPro

    Richard,

    After REPLACE and other commands, FoxPro stores the number of records in the
    variable _TALLY. There is a list of commands which affect _TALLY in the
    docs.

    Grab _TALLY's value right away, because your next action will give it a new
    value!

    --


    Cindy Winegarden

    Microsoft Certified Professional, Visual FoxPro
    Microsoft Visual FoxPro MVP

    cindy.winegarden@mvps.org



    "Richard Linhart" <richardl@astralc.com> wrote in message
    news:3a0c5d63$1@news.devx.com...
    |
    | Does anyone know how it would be possible to return the number of rows
    affected
    | by the Foxpro Replace command? For example:
    |
    | Replace Field1 with 'X' all for Field2='Y'
    |
    |



  3. #3
    Fred Taylor Guest

    Re: Replace command in FoxPro

    _TALLY

    --
    Fred


    "Richard Linhart" <richardl@astralc.com> wrote in message
    news:3a0c5d63$1@news.devx.com...
    >
    > Does anyone know how it would be possible to return the number of rows

    affected
    > by the Foxpro Replace command? For example:
    >
    > Replace Field1 with 'X' all for Field2='Y'
    >
    >




  4. #4
    John C. Gunvaldson Guest

    Re: Replace command in FoxPro

    How bout,

    _TALLY

    Contains the number of records processed by the most recently executed table
    command.

    It will return affected records on VFP commands "Pack, Replace, Sort, Total,
    Sum, Update, SELECT, Reindex, Index, Count, Calculate, Copy To, Average,
    Append From..."


    hth

    John


    "Richard Linhart" <richardl@astralc.com> wrote in message
    news:3a0c5d63$1@news.devx.com...
    >
    > Does anyone know how it would be possible to return the number of rows

    affected
    > by the Foxpro Replace command? For example:
    >
    > Replace Field1 with 'X' all for Field2='Y'
    >
    >




  5. #5
    Matt McQueen Guest

    Re: Replace command in FoxPro


    "Richard Linhart" <richardl@astralc.com> wrote in message
    news:3a0c5d63$1@news.devx.com...
    >
    > Does anyone know how it would be possible to return the number of rows

    affected
    > by the Foxpro Replace command? For example:
    >
    > Replace Field1 with 'X' all for Field2='Y'


    Check out the variable _TALLY.

    e.g.

    Replace Field1 with 'X' all for Field2='Y'
    ? _TALLY

    Best.

    Matt.



  6. #6
    Richard Linhart Guest

    Re: Replace command in FoxPro


    I couldn't find this command anywhere in the FoxPro portion of the MSDN.


    "Fred Taylor" <ftaylor@uswest.net> wrote:
    >_TALLY
    >
    >--
    >Fred
    >
    >
    >"Richard Linhart" <richardl@astralc.com> wrote in message
    >news:3a0c5d63$1@news.devx.com...
    >>
    >> Does anyone know how it would be possible to return the number of rows

    >affected
    >> by the Foxpro Replace command? For example:
    >>
    >> Replace Field1 with 'X' all for Field2='Y'
    >>
    >>

    >
    >



  7. #7
    Fred Taylor Guest

    Re: Replace command in FoxPro

    Really? In VFP, "HELP _TALLY" in the command window brought it up with no
    problem:


    _TALLY System Variable
    Example See Also

    Contains the number of records processed by the most recently executed table
    command.

    Syntax

    _TALLY = nRecords

    Arguments

    nRecords

    Contains a numeric value indicating the number of records processed by the
    most recently executed table command.

    Remarks

    Certain table processing commands return information about their status
    ("talk") while they execute. When such a command finishes executing, it
    displays the number of records it processed (if SET TALK is ON), and stores
    this number to the _TALLY system variable.

    The following commands return status information:

    APPEND FROM AVERAGE
    CALCULATE COPY To
    COUNT DELETE
    INDEX PACK
    REINDEX REPLACE
    SELECT - SQL SORT
    SUM TOTAL
    UPDATE


    When you start Visual FoxPro, _TALLY is set to 0. Executing one of the
    commands above replaces the _TALLY value with the number of records the
    command processed.

    --
    Fred


    "Richard Linhart" <richardl@astralc.com> wrote in message
    news:3a0c7303$1@news.devx.com...
    >
    > I couldn't find this command anywhere in the FoxPro portion of the MSDN.
    >
    >
    > "Fred Taylor" <ftaylor@uswest.net> wrote:
    > >_TALLY
    > >
    > >--
    > >Fred
    > >
    > >
    > >"Richard Linhart" <richardl@astralc.com> wrote in message
    > >news:3a0c5d63$1@news.devx.com...
    > >>
    > >> Does anyone know how it would be possible to return the number of rows

    > >affected
    > >> by the Foxpro Replace command? For example:
    > >>
    > >> Replace Field1 with 'X' all for Field2='Y'
    > >>
    > >>

    > >
    > >

    >




  8. #8
    Dan Freeman Guest

    Re: Replace command in FoxPro

    It's not a command. It's a system variable.

    Dan


    Richard Linhart <richardl@astralc.com> wrote in message
    news:3a0c7303$1@news.devx.com...
    >
    > I couldn't find this command anywhere in the FoxPro portion of the MSDN.
    >
    >
    > "Fred Taylor" <ftaylor@uswest.net> wrote:
    > >_TALLY
    > >
    > >--
    > >Fred
    > >
    > >
    > >"Richard Linhart" <richardl@astralc.com> wrote in message
    > >news:3a0c5d63$1@news.devx.com...
    > >>
    > >> Does anyone know how it would be possible to return the number of rows

    > >affected
    > >> by the Foxpro Replace command? For example:
    > >>
    > >> Replace Field1 with 'X' all for Field2='Y'
    > >>
    > >>

    > >
    > >

    >




  9. #9
    Ariel Gimenez Guest

    Re: Replace command in FoxPro

    better is
    UPDATE MYTABLE SET FIELD1 = 'X' WHERE FIELD2 = 'Y'
    ?_TALLY

    Update is better than replace...

    Ariel Gimenez



    "Matt McQueen" <mmcqueen@netcomuk.co.uk> wrote in message
    news:3a0c6dff@news.devx.com...
    >
    > "Richard Linhart" <richardl@astralc.com> wrote in message
    > news:3a0c5d63$1@news.devx.com...
    > >
    > > Does anyone know how it would be possible to return the number of rows

    > affected
    > > by the Foxpro Replace command? For example:
    > >
    > > Replace Field1 with 'X' all for Field2='Y'

    >
    > Check out the variable _TALLY.
    >
    > e.g.
    >
    > Replace Field1 with 'X' all for Field2='Y'
    > ? _TALLY
    >
    > Best.
    >
    > Matt.
    >
    >




  10. #10
    Tamar E. Granor Guest

    Re: Replace command in FoxPro

    On Sun, 12 Nov 2000 03:04:47 -0300, "Ariel Gimenez"
    <arielgimenez@yahoo.com> wrote:

    >better is
    >UPDATE MYTABLE SET FIELD1 = 'X' WHERE FIELD2 = 'Y'
    >?_TALLY
    >
    >Update is better than replace...
    >
    >Ariel Gimenez
    >


    Not necessarily. My testing shows that REPLACE is faster in almost
    every case. The one advantage of UPDATE is that it looks records
    individually (which is why it's slower) while REPLACE locks the entire
    table.

    Tamar

  11. #11
    Nancy Folsom Guest

    Re: Replace command in FoxPro

    In article <3a0c7303$1@news.devx.com>, richardl@astralc.com says...
    >
    > I couldn't find this command anywhere in the FoxPro portion of the MSDN.


    Hm. I found it (system variable as Dan pointed out) fine in MSDN using
    the Visual FoxPro Documentation subset, and searching on _TALLY. Just
    was curious because I often can't find stuff I'm looking for in the
    MSDN, but in this case it came up.

    BTW, do you know you can set your online help to point to the
    foxhelp.chm instead of the MSDN? Under Tools|Options|File
    Locations|Help file....the foxhelp.chm is in the same directory as the
    others. Search on your harddrive for it if you have trouble locating it.

    HTH.

    --
    Nancy
    So that all can benefit from the discussion,
    please post all followups to the newsgroup.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center