Which gadget to use

Just starting out? Need help? Post your questions and find answers here.
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Which gadget to use

Post by jak64 »

Hello,
To explain my request, I will take a simple example:

Let's imagine I have an Sqlite database with a table made up of records.

The table has 5 columns:

Transaction date
Description of operation
Debit
Credit
Balance

I want to display all these records with the possibility of modifying the Transaction date, Description of operation and Debit or Credit fields (the Balance must be updated automatically)

I would like it to look a bit like in Excel where you can position yourself in the cells if you want to modify them.

I looked at the different gadgets and I didn't find the one I could use (list-like gadget with several columns whose content can be modified).

Can you help me ?
normeus
Enthusiast
Enthusiast
Posts: 414
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: Which gadget to use

Post by normeus »

Use one of the excellent upgrades done to listIconGadget from a forum search:

@nalor created this one and @Papala added some great stuff
viewtopic.php?p=523919#p523919

To fancy it up, use ListEx-Module.pbi, @Thorsten1867's creation:
viewtopic.php?p=533673#p533673


Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Which gadget to use

Post by Marc56us »

Hi,

Using a spreadsheet gadget to manage a database is not a good idea, except for a very small database (and even then)

Indeed, you will have to detect and memorize each modification anywhere in the grid and then save everything at the end or save at each line change.

For applications of this type, we use "grid" (ListIconGadget) only to display and point to the line to be modified. The record data selected is then copied to an editing area next to it. This is much safer (and easier).

Moreover it allows to display fields much bigger than the grid, as well as images (contained in blobs)

:wink:
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Which gadget to use

Post by jak64 »

Hello Marc56us,

After thinking it over, that's what I'm going to do.

In fact, I wrote in VBA Excel, almost 20 years ago, a program to manage my budget with the creation of schedules, entry of operations, etc. which has served me well until now.

Since I discovered, 2 years ago, this very pleasant and powerful language that is PureBasic, I decided to rewrite my application in PureBasic.

That's why I was referring to Excel.

I think I will still store my data in a SqLite database and for updates, indeed, I will select the line to modify and I will copy the values ​​into the edit boxes below.

On the other hand, if I modify a date, I would like the update to be carried out automatically...
How to do ? Otherwise to copy all my table in a list, sort it and redisplay it in the ListIconGadget, but it may be long...

What do you think ?
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Which gadget to use

Post by Marc56us »

Hi jak64,

Two ways to manage the date of update
- By the PB application (FormatDate("...", Date())))
- By the SQL query at the time of insertion or modification.

In both cases, it is preferable to store the dates in ISO format (YYYYMMDD-HHMMSS). This allows sorting, even if the storage field is in text format.

To display again once sorted, unless you have hundreds of thousands of lines
- Empty the ListIcon (ClearGadgetItems())
- Make a SQL sorted query : SELECT ... ORDER BY filed_date ... LIMIT xxx
- Reload the ListIcon
It goes very fast and anyway, we never display a whole account (we limit ourselves to the current month or year for example)
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Which gadget to use

Post by jak64 »

In my VBA application, I just checked, I have about 1000 rows per year since it is only my personal management, so I think I will be able to load the whole table and for sorting, saving database and reloading shouldn't be too long
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Which gadget to use

Post by mk-soft »

Helper functions ...

Link: ShowDatabaseRows
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply