papafrankc,
.
I didn't test out the bugs, but you done a fine job with squashing them already.  Thanks for sharing your changes too.  I just hope I can remember them whenever I need to do this again in the future.
.
I'm not as experienced as some of the other folks here.  Just trying to give you some ideas to try because I have received a lot of useful help and ideas whenever I get in a pinch.  With that being said, anything you get from me needs to be extra tested!  LOL
.
As for your 2nd question, the only way I can think of for doing this is to copy back from the (hidden) text field when the user is editing via a ShowRecord condition.
.

procedure Form2_OnShow (Sender: TObject; Action: string);
begin
    form2.ComboBox1.Items.Clear ; // ADDED to clear the combo box
    Form2.ComboBox1.Items.Add('Spare');
    Form2.ComboBox1.Items.Add('Installed');

    // For editing
    if Action = 'ShowRecord' then
        Form2.Combobox1.Text := Form2.Edit1.Text;
end;

.
Again, I haven't tested it for use.  But it seems to work on the first attempt.  I have also changed this in my example project in case it's necessary for someone else to reference.

I wanted to share another alternative that also resolves the issue I was having:
.

SUM(COALESCE(tl.fuelGallons,'0,0')) as "TotalGallons"

.
This is basically doing the same thing as your suggestions, but I stumbled upon it in other examples.  Not sure if either of them are better than the other, but maybe someone more experienced in SQLite can answer that one. smile
.
[edit]
So, coalesce is for when you have more than two values.  In my case, it's only necessary for the IFNULL.  :thumbsup:
.
Thank you again sparrow.

papafrankc,
.
I have an example based on my interpretation of your question.  Maybe this gives you some ideas.

Okay.  Again, I appreciate you looking at it (even further than my initial question).
.
I'm not sure that I follow your suggestion, but I will re-evaluate the data and the structure.  But once I inserted either of your SQL snippets, everything checked out.
.
Thank you for your input!
.
--- Edit ---
.
I'll try to explain my thought process for the structure as they pertain to your suggestion.
.

the TRIP and TRIPLEG tables do not match in the STATE (id_state) part.

.
This is intentional because the TRIP table has it's own id_state separate from the leg's in the TRIPLEG table, so they would not necessarily match.
.
There is only 1 id_state in the TRIP table (per trip) and this captures the State where the trip begins.
.
All of the States from the id_state in the TRIPLEG table is to capture all of the points where the truck exits a (and crosses into a different) state.
.
--- ASIDE ---
I have tested other designs where the id_state field is only linked to the TRIPLEG table.  But to me, the id_state fields in the TRIPLEG table represent something different from the one in the TRIP table.
.
Namely- those are all exit points, and the one in the TRIP table is the start point.
.
Maybe this isn't necessary, and this is where I lack experience.  However, it is why I chose to store the id_state in two different tables.
.
But the user does need the distinction, and this is one of the ways I could think of to achieve this and not get it confused in the tablegrid with all the (exit point) legs.
---
.
I would appreciate ANY other feedback.

Very much appreciated sparrow!
.
They both seem to display the correct results.  I wish I could follow what was causing the problem, but that will be for another day.
.
Not sure if one is better than the other, but I will go with the 2nd one for now.

Hello all,
.
I'm out of ideas, and I would appreciate any help with this...
.
I believe the problem might be in my SQL, but I've tried everything that I know of.
.
I get strange results in two different months (July, and September). However, things seem to display fine for August. See the example screenshot.
.
At first I was using:
.

SUM(tl.fuelGallons) as "TotalGallons"

.
So then, I suspected a problem with the null values and switched it to this:
.

case when SUM(tl.fuelGallons) IS NULL then 0 else SUM(tl.fuelGallons) end as "TotalGallons"

.
But FastReport seems to be rounding the values. I have the display format set to %2.3n in both cases.
.
I know derek recommends using the standard reports instead of a SQL report, but I haven't found a way to group the values together.  If this is possible, I would prefer it.  I tried replicating it without using SQL, but I can't get the same result.

132

(6 replies, posted in General)

Hi AD1408,
.
This has worked for me in the past:
.

Form1.tbDaysBetween.Text := IntToStr(DaysBetween(Form1.beginDate.DateTime , Form1.endDate.DateTime));

.
In this example the beginDate and endDate are both DateTimePickers.
.
Also refer to: http://www.delphibasics.co.uk/RTL.asp?Name=DaysBetween

Derek,
.
Wow, that was really easy.  Sorry for asking such a simple question, but I would have never noticed that otherwise.
.
As always, thank you.  You are a master here.
.
Also thanks for the sorting tip too.  I have noticed sometimes FastReport seems to stutter when it first loads with that much data.

Hi All,
.
I was wondering if it is possible to get FastReport to use more of the page space by printing multiple columns instead of creating new pages. I tried resizing the width of the MasterData section, but this does not seem possible.
.
Has anyone else tried this? Is it possible? Any thoughts or ideas?
.
There have been a few cases where producing a similar report would be nice. My example is just a list of city names, but I have included screenshots as well.
.
Thanks

135

(5 replies, posted in General)

Awesome.  Thanks vovka3003.  That's even more simple than the scripts I have found.

136

(5 replies, posted in General)

While experimenting further with this, I noticed that MVD will create a clickable link to http urls.  This is neat, but I was trying to get this working for mailto links as well...
.
I found other posts that have done this (opening an e-mail client) using scripts, but I was wondering if there was a way to get MVD to do it natively before I use scripting for it.
.
I have tried appending the mailto: portion to the front of the field as well as saving it in the field data, but neither seem have the same result as the http:// links do.
.
Any thoughts?

137

(5 replies, posted in General)

Hi derek,
.
That's what I was looking for.  I overlooked the ReadOnly property.  I was getting it confused with the Enabled property which doesn't allow the field text to be selected.  This way the contents may still be selected and copied.
.
Many thanks!

138

(5 replies, posted in General)

Hi all,
.
I was hoping someone has tried this before, but I was unable to find any related posts.
.
I'm trying to change the font color for a field that has the enable property set to false.
.
These are the things that I have tried already:

  • manually changing the font color in the field's property

  • using an OnChange event for the tablegrid related to the field

.
I don't have any other ideas to try, so I thought I would ask.
.
Normally shading the disabled fields is desirable, but I have a case where a different color would be helpful.

139

(11 replies, posted in Reports)

Hello folks!
.
I'm posting this prior to looking at any of the examples.
The 10 records was just an example here.  I believe the form we use has at least 15 but less than 20.  It is actually oriented in landscape too.  However, none of those details are important, but I'm trying to get an idea for how to implement this using MVD.  I have other projects that will also make use of this technique.
.
sparrow:
Yes, I was considering a temporary table like you described.  I had also thought about capturing a PDF once the order had been processed (and would no longer be changeable). Then removing those excess null fields altogether.
.
derek:
Again, that is exactly what I would like in FastReport.  Do you happen to know which version that is?  If I were to purchase a separate copy of FastReport, would it able to work with MVD (even if it uses the older version)?  I'm sure they have probably changed the file format by now tho...
.
ehwagner:
Thanks for chimming in with the extra cents.  You have me even more curious now with the overlay.  I have noticed that overlay group before, but had no idea how to use it.  It sounds like you have a good example for me to learn how it works tho.
.
sparrow:
Regarding your question about > 10 lines-  You are correct.  The additional lines would go on to page 2, but as I mentioned, it's closer to < 20.  Rarely do they order more than 1 page at a time.
.
I greatly appreciate all your efforts, comments and examples here!

140

(3 replies, posted in Reports)

Hello bbrother,
.
I used an OnBeforePrint event on the MasterData1 of the report that checks the values of your fields. Then replaced the text to null if they were 0 as in your example.
.
See the screenshot.

141

(11 replies, posted in Reports)

Okay, I was able to find and create solutions to both of my questions. I feel certain that there is a better way to do the blank-line reporting without creating empty records in the database.
.
Derek, I was able to get the signature field in the footer using some SQL. I stumbled around and noticed the Code section in FastReport. I created a variable from there holding the value of the query. But I do prefer the way you mentioned much better. That's exactly what I was looking for.
.
Sparrow, as for more details have a look at the attached example. It demonstrates the reports that I'm after. Namely, a form that matches the format of a company standard form with a set amount of lines. Regardless of the data, or lack thereof.
.
Again, my approach populates empty rows into the database in order to achieve this. It is certainly not the ideal solution, but until I can find another way, this will get me by for now. Hopefully someone else can make use of the example too.
.
As always, I appreciate the help and suggestions!

142

(11 replies, posted in Reports)

Thanks for finding that post sparrow. That one is also an old thread from 2015. I was hoping that there might be a way to do it now, but it seems that footers are for calculations only.

As for the other question, I will resort to my 2nd method for now. I'm hopeful that someone has a different technique that they will share.

143

(11 replies, posted in Reports)

Greetings!


I could use a few tips with this report.


A) I'm trying to re-create an existing form. So far, I have found two options:


  1) paste a copy of the original form in the background of a report.
    I don't prefer this one because I can't determine print margins to line up with the data fields. (Very tedious)


  2) populate fields with (a pre-defined amount) of NULL values.
    However, this is a lot of overhead in the database.
    And- I was unable to get this working with my example.


This may be obvious- but the reason for this, is because the normal form can be hand-written. The printed report is intended to replicate this form which will allow for further hand-written notes.


B) Also, I'm unable to reference fields in any of the footers. To indicate who created the entry before signing it. (I have attempted this in the example)


Aside note, I ran across an old post from derek back in 2017 (I was unable to locate it when I posted this), but he was asking the exact same question. Back then he was asking if was a bug, and there was no reply after. So it makes me wonder if it may be possible now.

144

(4 replies, posted in General)

Hello again,

It has been a week now dabbling with this project.  I have ran into a limitation it seems...

I found a similar post (http://myvisualdatabase.com/forum/viewtopic.php?id=3469) that describes what I was trying to accomplish.

It describes an excel-like interface using the table grid which is not (yet) possible.  Unless someone else has come up with something since then?

I wanted to share the results of what I was able to achieve at this point.

Thanks again to those that offered suggestions.
-joshuA

145

(4 replies, posted in General)

k245:

Use the ability to edit data in the table itself. The properties of the table in the Editable section are responsible for this - AllowCreate, AllowEdit and AllowDelete.

I had both tableGrids already using those properties, but thanks for the response.


Derek:

Not sure if I understand the question totally but it sounds like you're wanting to relate records between two editable grids.
It's more normal (I think!) to use an editable grid for things like look-up data and that's pretty straightforward.
Linking editable grids is slightly more tricky, mainly when adding a new record in the subordinate (child) grid because you seem to have to manually enter the key of the parent record (although it does make moving a child record to a different parent very easy).

Sorry about the question- it was not clear at all.  You managed to answer it anyway though.

I'm okay using buttons for the first grid, but the second grid must be on a different form with editable properties.

I couldn't figure out how to get the second grid working after the parent was created in the first grid.  I briefly looked at your example this morning.  Once I examine it closer, I'm sure I can figure out the rest.

Thank you a lot derek!
-joshuA

146

(4 replies, posted in General)

Hi All,

I have another task that I'm unable to solve.  This seems simple, but I cannot figure out what I'm missing.


The most important part is to add/edit/remove from the second tableGrid without creating extra forms.  I'm able to get that working already.


I had to externally add the data to demonstrate this example.


Could someone offer some advise or direction?


Thanks in advance,
-joshuA

Thanks a lot Derek!
You uncovered several techniques there that I have been trying to figure out. And I had no idea how to do that calculation with SQL either.  I really appreciate it!
I'm sure I'll have other questions along the way wink

And here is the project

Hi MVD,
I cannot figure out a way to calculate the running miles between each stop during a trip.
Using the OD readings (16737 - 16641 = 96), etc.
The best example from the sample data provided, is trip ID 8 (screenshot) because the input for each stop is not in order (circled in red). Being able to allow out of order input is necessary for user corrections (or adjustments).
Note: The values in red are edits.

150

(5 replies, posted in General)

Hi Derek and Dmitry,


Thanks for understanding about the missing attachment.


Using a table for "two different purposes" as you describe... This is an acceptable practice though, right? Aside from the working solution, this is one of the indirect questions I was asking.


The part about being "not quite as straightforward" is this because of MVD specifically? Because I have dealt with similar situations in other software that I've used, but it can cause some confusion in larger projects.


I appreciate the example and as always your helpful replies. This will certainly provide me with more ideas as I learn MVD.


This is only a piece of a larger project, and I didn't provide any extra details about it. So it would seem odd to have each state listed as a neighboring state, but there is a reason for that...


I imagine that (this reason above) is something that could be handled within MVD itself, but my inexperience doesn't allow me to take that approach yet...


The larger project is for fleet management (vehicles traveling between the states). Each trip has legs which can represent any stopping point (even within the same state). The main purpose (excuse me if this is obvious) is for these boundary ComboBoxes to limit AND reduce the states presented to the user.


Thank you again folks!