Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Show record counter of CA cursor
Message
De
09/12/2014 05:57:45
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01612016
Message ID:
01612031
Vues:
45
>>>>>>Hi,
>>>>>>I need to show "record" counter for the CursorAdapter cursor; for example, "Record 1 of 100."
>>>>>>I cannot use recno() because the cursor is indexed and recno() does not show in a sequential order.
>>>>>>I tried to add a "dummy" column to the CA cursor. But I get message that this operation is not allowed for buffered cursor. When I tried to set the buffering to 1 (using CURSORSETPROP("Buffering", 1, "CA_ALIAS") I get message that "Operation is not allowed for CursorAdapter"
>>>>>>The only option remaining (as far as I can think of) is to add a "dummy" column to the table and use it to assign sequential numbers. Even though the table is not very large, it would waste database space (this is SQL Server database).
>>>>>>Any suggestions on how else I can accomplish this?
>>>>>
>>>>>
>>>>>Instead of CURSORSETPROP("Buffering", 1, "CA_ALIAS") try to use CURSORSETPROP("Buffering", 3, "CA_ALIAS").
>>>>
>>>>Yes, changing from 1 to 3 allows the CURSORSETPROP() to be executed without an error. However, when I do ALTER TABLE ADD COLUMN ... I get error message that "Function is not supported on remote tables." So I am back to considering a "dummy" column.
>>>>Thank you for your help.
>>>
>>>Add this field in SelectCmd property of the CA (if you use CursorSchema add it there also) :
>>>Do not add it in Update... lists properties.
>>>
>>>
>>>this.SelectCmd = "SELECT ...., CAST(0 as int) AS RecNum FROM ..."
>>>
>>
>>Was one of my suggestions as well, but has the problem of resetting with each used index, if they are really needed. Otherwise adding Order By to the .SelectCmd and using the Recno() of the Cursor with no index is clearer IMO.
>
>I'm totally agreed with your suggestions but if Dmitry wants to change the order every time user click on grid header then "ORDER BY" in SelectCmd is not an option.
>That is why I suggested this additional field so Dmitry can choose :-)

Raises the interesting question, if only "Rangenumbers" not really physical recno's are shown, if such a task should be carried down into the biz/local data layer or such pagination style numbering should be left totally to the GUI or - better - to a GUI-controller...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform