Topic: ForDerek

Hello Derek
Can I send you a request for help by PM?
Thanks in advance
JB

Re: ForDerek

Hi Jean,
Not a problem.
Derek.

Re: ForDerek

Hello Derek
Thank for your answer
An email address where I can send my project ?
Thanks in advance

JB

Re: ForDerek

Salut Jean,
You should be able to send your message / project using the email associated with the userid (see screenshot).
I tried to message you yesterday using your ***@laposte.net address but it couldn't be delivered.
Regards,
Derek.

Post's attachments

Attachment icon jb.jpg 40.39 kb, 9 downloads since 2024-03-05 

Re: ForDerek

Hello Derek, how are you?
I created an application with MVD from a skeleton of
one of your projects (the management of family accounts).
I arranged it to my liking and it works very well.
I wanted to add a new function: archiving of the year
former. For this I set up one of your projects which would be suitable
very good at this new approach (CheckBox As Filter).
It functions in its essential role: removing checked lines from the database.
But what bothers me is that when I click on the 'PURGE' button
(I've called it 'ARCHIVAGE'), it does not show me the grid having only the lines
checked (whether I use button B4 or button 21). As a result, the Excel sheet is not displayed
not either, which will allow me to save the past year in XLS form).

For example, let's say I want to archive the period from 02/09/2023 to 02/21/2024.

1- I choose 'Compte courant communt' from the 'Les Comptes' menu on the left. The grid is displayed with all transactions.
2- I click on the 'Archivage des données' menu. Panel 13 is displayed
3- I check the relevant dates on the grid
4- From this panel I click 'Filtrer les opérations'. An action already occurs instead of checking this option. Strange !.
5- The grid does not show me only the selected lines as in your example from which I took inspiration.
6- As a result, the Excel sheet is not displayed which would allow me to save this selection as an archive.
7- On the other hand, the work of deleting the selected lines is done well.

No matter how much I look at the solution from every angle, I end up seeing nothing.
I would need your insight: your example works very well, but for me, there is something wrong somewhere.

May I allow myself to submit my project to you because I don't see where the problem lies.
Thanks don't advance

JB

Post's attachments

Attachment icon MES COMPTES_04012024.zip 973.2 kb, 38 downloads since 2024-03-05 

Re: ForDerek

Salut Jean,
Hope you and the family are doing well.
I think the specific issue you had with your project should be fixed now.
Basically, the export to Excel will take all of the rows in form1.tablegrid1 that are displayed.
So the extra step that you need to insert is a filter that displays only those rows that have been checked (filter by tflag = 1 (form1.button22).
I've put this as the 'on click procedure for form1.button21
Then the 'on after click' procedure for form1.button21 performs the export to Excel and deletes the checked rows from the database.
I hope that's clear.
Sorry but I messed up your script a bit - I needed to keep various panels and buttons visible while I was testing and it was driving me crazy when they kept disappearing smile.  But if you search within the script for '//derek', I have commented the lines that I've changed so it should be fairly easy to change things back.
One thing I'm not sure about is what happens to the 'running balance' if you delete records - doesn't it mean that the 'running balance' is going to correct only for those records that remain in the database?  Or will you add a new row with some sort of 'carried forward' amount (a bit like you do when you initially created the application and the very first row you add is an 'opening balance'?
Anyway, hope this helps,
Regards,
Derek.

Post's attachments

Attachment icon MES COMPTES fixed I hope.zip 1.28 mb, 60 downloads since 2024-03-06 

Re: ForDerek

Hello Derek, how are you ?

Thank you for your answer.
It works perfectly.
As I like with MVD (it's exhilarating) also finding my own solutions
without always asking others, I am looking for the
mine.
Here's what I'm testing:
1- Two DateTimePicker (Start Date and End Date: for example: 01/01/2023 to 31/12/2023).
2- From these two dates, selection of transactions between these two dates
(via SEARCH, dbSQL or SearchQuery).
3- Display in the MVD grid of only these selected transactions.
4- These transactions are checked
5- Display of transactions in Excel (or even save to disk).
6- Deletion of these transactions in MVD.
7- To maintain the correct balance, addition of a first line of the new grid with the new
starting balance (which will be that as of 131/12/2023).

From this pseudo code I should achieve the same result as that of your proposal.
What do you think of this approach which seems quite simple to me?
Thanks again
JB

Re: ForDerek

Hello Derek, how are you ?

Thank you for your answer.
It works perfectly.
As I like with MVD (it's exhilarating) also finding my own solutions
without always asking others, I am looking for the
mine.
Here's what I'm testing:
1- Two DateTimePicker (Start Date and End Date: for example: 01/01/2023 to 31/12/2023).
2- From these two dates, selection of transactions between these two dates
(via SEARCH, dbSQLExecute or SearchQuery).
3- Display in the MVD grid of only these selected transactions.
4- These transactions are checked
5- Display of transactions in Excel (or even save to disk).
6- Deletion of these transactions in MVD.
7- To maintain the correct balance, addition of a first line of the new grid with the new
starting balance (which will be that as of 131/12/2023).

From this pseudo code I should achieve the same result as that of your proposal.
What do you think of this approach which seems quite simple to me?
Thanks again
JB

Re: ForDerek

Salut Jean,
Yes, I think that should work.
But a couple of things to be careful about.
1.  using your example, you would need to make sure that there were no transactions dated prior to 01/01/2023 (but it's a simple test to check for this).
2.  when you create a line with a new starting balance, you might also need to bring forward the balances of 'depenses' and 'recettes' (otherwise doesn't this make your tablegrid.footer calculation of 'Solde' incorrect?).
I was also wondering whether holding 'tpaidin' and 'tpaidout' as absolute values in two discrete fields rather than simply using a single field (tvalue) and signing it positive or negative doesn't start to make things more complicated than it needs to be (and yes, I appreciate the irony of suggesting this as it was me who used absolute values in the first place roll )!!  I must have thought it was a good idea at the time but I can't remember why!
Can I ask why you want to delete transactions in the first place rather than use something like a filter?
Derek.

Re: ForDerek

Hello Derek
Thank you for your answer.
From the elements communicated, I took over the Archiving part of the
banking program while simplifying it in the process.
1 - I choose an account (here Common Current Account).
2 - I click on the 'Archiver les données' menu.
3 - The 'Archivage' panel is displayed with two DTPs and 3 icons. I choose the Start dates
        and End of desired archiving period.
4 - I click on the magnifying glass and the matching lines are displayed. I check them automatically.
4Bis - Eventually I can send them to Excel in order to save this archiving on disk.
        Useful when you want to save an entire year.
5 - I click finally to purge the base of these checked lines.

Until step 4Bis everything works perfectly. I get the desired result.
The problem lies in step 5. Instead of offering me a global deletion in one shot of
all the lines selected (as in your example), the project only offers me a line by line deletion
with deletion confirmation message for each line.

However, I used (practically copied/pasted) instructions from your example.
But there, I'm drying up.
Did I miss an instruction?
Aren't TFlags applied to all the lines you want?
I admit that I don't see where the wolf is.
If you can be so kind as to take a look, I'll thank you in advance.
Sincerely
J.B.

Post's attachments

Attachment icon MES COMPTES_TEST.zip 1.14 mb, 23 downloads since 2024-03-10 

Re: ForDerek

Hello Derek
How are you ?

I think I found the solution to my problem

1 - I left Action = Delete Record behind button 21 (PURGE). I deleted it
2 - I modified the code for purging the Purge button: (Action OnClick)

procedure Form1_Button23_OnClick(Sender: TObject; var Cancel: boolean); // Once the spreadsheet is closed, we delete the checked lines
Var IRow, vcount: Integer;
begin
      vcount := 0;
       For vi := 0 to Form1.Tablegrid1.RowCount -1 do
       begin
          SqlExecute('Delete From Transactions Where id = "'+IntToStr(Form1.Tablegrid1.dbIndexToID(vi))+'"');
          vcount := vcount+1;
       end;
          Form1.TableGrid1.dbUpdate;
          ShowMessage(IntToStr(vcount) + 'archived lines');
end;

At first glance, this seems to have solved my problem.
What do you think ?
Sincerely
J.B.

Re: ForDerek

Helo Derek

All is now OK with my projetc.

Selection of dates to archive -> OK
Check the dates to archive -> OK
Archiving of the selected year (I archive year by year) -> OK
For the current year, I add in the first line the
last year's balance -> OK
and what you feared did not come true, the balance is correct -> OK

So, I deleted the TFlage field which was no longer useful to me, I didn't use it in my new version -> OK

Very satisfied, the project is fully operational.
Thank you very much again for your effective help as usual.
Besides, on the Splash screen (Author Icon), I took the liberty of mentioning your name.
Sincerely
J.B.

Re: ForDerek

Salut Jean,
Glad everything is working okay now.
I had a quick look last night and also noticed the 'delete action' on form1.button23 but removing it still didn't fix the problem.  I was going to have a look this afternoon but you've beaten me to the finish line big_smile.
You mentioned the splash screen - I put a bit of 'animation' on mine (there are various styles you could use);  attached is an example using a 'fade in - fade out' effect if it's something you're interested in looking it.
Regards,
Derek.

Post's attachments

Attachment icon fading in and out.zip 699.14 kb, 35 downloads since 2024-03-11