Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting a line number in a View...
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00565959
Message ID:
00565968
Views:
20
This message has been marked as the solution to the initial question of the thread.
>I need to set the Line number in my view. This updatable view has a extra field call line. This field is the number of the line according to the order set in the view.
>
>How can I set this line Number in my view? I need this field to be reset when I do Requery().

Hi Jean Rene,

Here's a trick similar to one I just used to track something:

Create a prg called MyLineCounter
if vartype( gLineCount) = "U"
   public gLineCount
   gLineCount = 0
endif

if vartype( gLastCountTime) = "U"
   public gLastCountTime
   gLastCountTime = 0
endif

if seconds() - gLastCountTime > 2
   * If this function was called more than 2 seconds ago
   * that must have been done by another query. Therefore
   * we reset the linecount value to 0.
   gLineCount = 0
endif

gLineCount = gLineCount + 1
gLastCountTime = seconds()

return gLineCount
Then in your view:

Select MyLineCounter() as LineNumber, ....

It's not the most straightforward way and I'm sure others will come up with more creative solutions, but it poped up when I saw your question. Hope it helps!

Alex
Low-carb diet not working? Try the Low-food diet instead!
Previous
Reply
Map
View

Click here to load this message in the networking platform