Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting
Message
From
06/06/2002 03:52:33
 
 
To
05/06/2002 20:36:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00664835
Message ID:
00665294
Views:
31
This message has been marked as the solution to the initial question of the thread.
Hi!

In Split method you should do something like following (see for my comments in code):
SELECT myCursor
GO (Thisform.recordno)
IF cSplit = 'M'
  skip && !!! we should start renumbering from NEXT record
  if !EOF()
    Replace cno WITH cno+1 REST && !!! increase order number for all records starting from current
  endif
  GO (Thisform.recordno)
  ln_no    = cNO
  lc_Prod  = cProd
  lc_split = cSplit

  SELECT myCursor
  Append Blank
  Replace cNo    WITH ln_no+1
  REPLACE cprod  WITH lc_prod
  replace cSplit WITH 'C'
  Thisform.ShowGrid()
Endif
* Thisform.Sort_no() && !!! No need to call Sort_No again.
Thisform.Grid1.Refresh()
>Hi,
>When I click on Split Button at 1st column of grid, I will call Split method
>From the Split Method I call method Sort_No for sorting. It seek work ok but only for once time, It doesnt work when i add the second record for the same record. Any suggestion?
>
>In Method Sort_No
> SELECT myCursor
> INDEX ON cProd+STR(cno,2) TO cSort
> SET ORDER TO cSort
>
> SELECT myCursor
> no_rec = 0
> Go Top
> Do While !EOF()
>  no_rec = no_rec + 1
>  Repl cno WITH no_rec
>  Select MyCursor
>  Skip
> Endd
>
>
>
>In Split Method
>
> SELECT myCursor
> GO Thisform.recordno
> IF cSplit = 'M'
>  Replace cno WITH cno+1
>  ln_no    = cNO
>  lc_Prod  = cProd
>  lc_split = cSplit
>
>  SELECT myCursor
>  Append Blank
>  Replace cNo    WITH ln_no+1
>  REPLACE cprod  WITH lc_prod
>  replace cSplit WITH 'C'
>  Thisform.ShowGrid()
> Endif
> Thisform.Sort_no()
> Thisform.Grid1.Refresh()
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform