|
| Iniciado por guest, 20,mar. 2016 08:40 - 12 respuestas |
| |
| | | |
|
| |
| Publicado el 20,marzo 2016 - 08:40 |
Hello,
Windev 20. New to WX
I plan to use a table control to display the following details from a file (POS system)
1. ItemCode 2. ItemName 3. Quantity 4. Rate 5. Discount % 6. Amount
Need to know how to update those details to database, using hAdd, both in insert mode and edit mode. In edit mode, possibility of deleting row(s) is there. How to deal with these deletions ?
Every row needs to be added with hAdd, modified rows need to be modified with hModify and deleted rows needs hDelete.
Is there any example(s) available with WX ? Or any sample code will be better.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2016 - 10:48 |
Dear Sivaprakash,
you will find a Tutorial_Windev.pdf in the sub-directory \Tutorial of your installed WINDEV directory. First step for all newcomers to any Wx product is to work through a good part of this manual in order to become acquainted with the product. All basic questions will be answered there and much, much more!
The Tutorial lets you make and work with some example programs (found in \Examples\Training) plus there a several hundred other examples which are either "unit examples" means, they're just bricks of bigger programs or "complete examples" which can be run immediately. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2016 - 13:13 |
Hi Sivaprakash,
If we assume that editing (and deleting) is something RARE in a POS System: (1) INSERT MODE : just loop through the memory table and use HADD (2) EDIT MODE: (a) loop through all the records associated with this transaction, using a query. (b) in the loop retrieve the records AND delete them, using HDELETE. (c) now loop through the memory table and use HADD to add everything again (just like 1)
This is the most CLEAN and SIMPLE way to go.
Ofcourse - in EDITING mode - you could KEEP the primary key of your record as you retrieve it and load it in your memory table. This way if there is a primary key in a memory table row, you just retrieve the record and do a HMODIFY. If there isn't a primary key, it means this is a NEW record so you use HADD to add it. The problem here is that you must add code to see if any records have been deleted by the user and are not anymore in the memory table.
But I don't think you must actually work in the above scenario with a POS System.
Also beware of LEGAL issues editing and deleting entries on a POS system. At least in GREECE it is ILLEGAL to edit/or delete an entry in a POS system. But you can legally do editing and deleting of an INVOICE and for that case I use a CANCEL procedure.
Steven Sitas |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2016 - 14:55 |
Hello Guenter Predl,
Thanks. Yes, I'm going through the manual, examples, and other stuffs that I get while on the way. Sometimes, it's becoming time consuming to get details of our interest. In those cases, I feel a link or code snippets or hints from experienced ones is really helpful. And I'm delighted that I get good suggestions from this forum.
Thanks once again.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,marzo 2016 - 14:57 |
Hi Steven Sitas,
Thanks for your hint Steven Sitas. I'm from Powerbuilder area, where we used to just check the box 'Delete and Insert' or 'Update' option in the datawindow, where everything you mentioned is taken care of.
Thanks for your help.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,marzo 2016 - 02:17 |
Hi
well everything CAN be done automatically, if your table is linked to a file and is in edit mode, with addition. Then you don't need any code. Any change done in the table control is reported in the file. It's just one of the many option that the table control offers
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,marzo 2016 - 09:12 |
Hi Fabrice, I don't think you can do this thing in Windev, without code. Lets say the user is changing (or deleting or inserting) data in a table (linked to a file) and at the end he wants to CANCEL all these changes etc. So all the above must be in some kind of transaction. And we all know that it is a VERY BAD IDEA to start transactions while a user is "active" in the User Interface ... Looks like Sivaprakash is coming from PowerBuilder, where DataWindows is/was a really powerful control, that handled the above AUTOMATICALLY.
It is sad that this great product is not now actively developed any more ...
Steven Sitas |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,marzo 2016 - 10:51 |
Hi
I use the second method stevan mentioned. Ok you have to do some coding but he it is with wlanguage so verry doable comparing to other languages :spos:
regards Allard |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,marzo 2016 - 12:00 |
Hi Steven
you may be right. But CANCELLING the changes was -NOT- in the original question OR in the followup. So everything that the OP described is possible automatically. Now, if there are other requirements....
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,marzo 2016 - 15:42 |
Steven Sitas,
Yes, Powerbuilder's DataWindow is really powerful in this case. FYI, PB development is now took by Novalys (http://www.novalys.net/ ) from SAP. Great expectations from them.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,marzo 2016 - 15:48 |
Hello Fabrice Harari,
I'vent mentioned CANCELLING option in my question, but I mentioned about hAdd, hModify, etc. Hope we cannot (need not) use those h* commands when table is linked to a file.
And I think it's obvious that Saving is not a must. And we need transactions too.....
It looks like that 2nd one by Steven Sitas is preferably to me, as I used to set the same settings in my powerbuilder applications, only difference being I need to code it here.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,marzo 2016 - 16:30 |
Hello again
if you need transaction, you need to code... Everything else (adding, editing, deleting) can be done automatically by a properly set up control table.
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,marzo 2016 - 08:36 |
Thanks Fabrice Harari for your reply.
Since I need to use both h* functions and need transactions, the only option is to code it.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | | | |
| | |
|