726

(2 replies, posted in General)

Cool!! Thanks Dmitry

727

(2 replies, posted in General)

Is it possible to display a small picture like an icon in a column in a grid?

I have attached a screenshot.

728

(10 replies, posted in SQL queries)

What a shame.... it is way easier to populate a logging table without all the scripting

Here I have a simple example (I use SqliteStudio to create the triggers):

--  Create an insert trigger
CREATE TRIGGER insert_Maint_log AFTER INSERT  ON Maintenance
BEGIN

  INSERT INTO logs  (    
    Change_date,
    Maint_PcName,            
    Maint_id_Typ           ,
    sqlAction         ,
    Maint_details       ,
    Maint_date,
    src,
    username
    
      
        
    )

          values (
DATETIME('NOW'),
new.PCName,
new.id_Pc_Typ,
'INSERT',
new.Maint_Details,
new.Maint_date,Maintenance,
????????);

END;

729

(9 replies, posted in General)

Dmitry, I have sent my project smile

730

(9 replies, posted in General)

The problem is that, I tried the sizeable=true parameter but it messes up everything when you resize manually the windows, the main window is resized in one direction each time whereas the content does not resize nor move to adapt to the new size... so weird!!

So when I set sizeable=true to a form and afterward I want to resize the window to adapt to current resolution, the main window resizes on top of its content!!!

I will try to play with the anchors settings for each component, but I doubt it would fix the resolution issue...

731

(9 replies, posted in General)

Oh, it reminds me something very important regarding using mvdb applications on small screens.

Is there any way to make a common mvdb application developped on a "standard" office screen display correctly on a smaller screen? I mean, I have developped an application with mvdb on my desktop computer with a very comfortable screen, but when time has come to use this application on a laptop, it becomes nearly unusable as the windows do not scale the new screen. I have even tried on a windows 8 tablet, it is just a nightmare.

Is it somehow planned to implement auto-scale windows to fit any kind of screen,? This is already possible in css so why not with "hard" programming big_smile

732

(10 replies, posted in SQL queries)

Thanks Dmitry


and to populate the column "username", is it as follow?


insert into ...blablabla (column_names, blablabla...., username)
values (blablabla, values, blablabla..., '+sUsername+') 


or like this?

insert into ...blablabla (column_names, blablabla...., username)
values (blablabla, values, blablabla..., $Username)

733

(10 replies, posted in SQL queries)

I have a very specific question. Is it possible to retrieve the Windows username using the application and use it to populate a table via a SQLite trigger?

I managed to populate a log table for any change occuring in any table via trigger but I struggle in getting the connected username. Any suggestion?

734

(16 replies, posted in Script)

Actually, it does not work using specific scripts with dates

procedure Form1_GridEmployees_OnChange (Sender: string);
var
   i,c: integer;
   s: string;
begin
     c := Form1.GridEmployees.RowCount - 1;
     for i := 0 to c do
     begin
         s := Form1.GridEmployees.Cells[2,i];
         if ValidDate(s) then
             if (StrToDate(s) - 15) >= now then Form1.GridEmployees.Cell[2,i].Color := $0066FF66;
             if (StrToDate(s) - 15) < now then Form1.GridEmployees.Cell[2,i].Color := $0066FFFF;
             if (StrToDate(s) - 7) < now then Form1.GridEmployees.Cell[2,i].Color := clRed;
     end;
end;

I could not get this script working properly, maybe it is due to the code, I copied it from another section of the forum for tests...

I would like to change the colour of all rows in a grid depending on the date in a table (date1).


If date1 >= (today -28) = nice green
if date1 <= (today -15) = nice orange
if date1 >= (today -7) = red


This is tricky!!

735

(12 replies, posted in General)

Thanks Dmitry,


It works absolutely fine, I have added the code to disable the buttons once db is set-up to avoid modification by the end users.

Form1.Help_DBImage1.dbShowButtons := False;

I use the dbimage for the help section of my application smile

736

(16 replies, posted in Script)

No Problem, I tried to input the colours using the hexa codes but it does not work in 1.50 beta...

737

(12 replies, posted in General)

How do you display a picture which has been saved in the database please?

I tried this feature, I have a picture in the database but no way on how to display it using 1.50 beta.

738

(12 replies, posted in General)

Well actually, I could not get it to work properly using 1.50 beta. I get only red or nothing and when I use multiple rows, I have a refresh issue: first there is no colour and when I click in the grid, the cell change to red.

739

(12 replies, posted in Script)

Actually, I would like to have a condition on the text as well so the colour would not apply on all rows with a number in the set colour range....

so the 2 variables are

cell 1 (Status) and cell 2 (Count)

in cell 1 I can have different text : Ready, Defect, To restage

in cell 2 I can have different numbers : from 0 to n

but I do not want cell 2 of each row being colored the same way on each row!

If I use the current known scripts, all row change their colour when the count reaches the defined threshold which is useless in my project. I need different colours for different information, a count of 2 Ready would be Red whereas a count of 2 Defect would be Green and a count of 2 To restage would be Orange, you see!

740

(14 replies, posted in General)

Dmitry found the error in the query, thanks again!!

procedure Form1_Button5_OnClick (Sender: string; var Cancel: boolean);
var
    sPCName: string;
begin
    sPCName := Admin.EditPCName.sqlValue; // get current PCName

    Admin.TableGrid1.dbSQL:='SELECT PCName, id_Pc_Typ, Maint_details, Maint_Date FROM Maintenance WHERE PCName='+sPCName+;
    Admin.TableGrid1.dbListFieldsNames :='PC Name,Model,Details Maint,Date Maint'; 
    Admin.TableGrid1.dbSQLExecute;
end;

Check the end of the query (where blablabla= '+blablabla+;) , it works perfectly with 1.50 beta at the moment.

I am so happy smile

741

(12 replies, posted in Script)

I have a simple grid which displays the result of the following query:

SELECT *
FROM
(
   SELECT 'Ready'  as "Status", COUNT(id)  AS Count FROM computers where id_status="3"
  UNION ALL
  SELECT 'Defect'  as "Status", COUNT(id)  AS Count FROM computers where id_status="2"
   UNION ALL
  SELECT 'To be Restaged'  as "Status", COUNT(id)  AS Count FROM computers where id_status="4"

) temp

And it is displayed as shown in the attached screenshot.

The colours are not yet established, it is under construction wink

742

(12 replies, posted in Script)

Thanks for the link, but I am not a programmer, this is why I am using MVDB big_smile 

What I am looking for is an example to be able to understand how I could implement it in my project. The only example I know does not make any difference on the column "status", it just check the value in column "Count".

I will try to sort it out but I guess I will have to write a condition for each status + each way of counting...

743

(12 replies, posted in General)

Thanks for the script mathmathou, I was looking for something like this smile

744

(14 replies, posted in General)

I sent you the project and thanks again for your precious help! smile

745

(12 replies, posted in Script)

Another question on same topic, is it possible to change colours depending on cell with 2 variables?

example:


Status                     Count

Ready                     40                  ---------> above 5= green, under 5=Red
Defect                     3                    ---------> 0= green, from 1=text red, above 2= background red
Unavailable             2                   ---------> 0= green, from 1=text red, above 5= background red


Can I change the colours depending of the count for each status independently but in same tablegrid?

I remember also having seen a topic about changing the colour depending on time... will try to retrieve it.

746

(14 replies, posted in General)

Hi Dmitry,

this is approaching the result I am looking for but I got no record returned. Only the headers...

See screenshot using 1.50 beta + your script.

747

(4 replies, posted in Script)

Yes it is, sorry for the double post

748

(14 replies, posted in General)

Here is exactly what I want to do but MVDB does a mistake in the query, check the attached screenshot. In red rectangle, you can see what I get as a result sad

I tried with a script but I could not get it even returning the column name, it does nothing:

procedure Form1_Button5_OnClick (Sender: string; var Cancel: boolean);
var
    sPCName: string;
   

    begin
        sPCName := Admin.EditPCName.sqlValue; // get current PCName
        Admin.TableGrid1.dbSQL:= SQLExecute('SELECT PCName as "PC Name", id_Pc_Typ as "Model", Maint_details as "Details Maint.", Maint_Date as "Date Maint." FROM Maintenance WHERE PCName='+sPCName); // get information related to current PCName
       
    end;

749

(4 replies, posted in Script)

And how to display the records into a grid when getting the variable from a textbox?

750

(14 replies, posted in General)

@mathmathou, my fault, I wrote database, I was thinking table ( tireness....) MVDB currently does not support the use of multiple databases.

@rjkantor, I think you got it, I will try your trick, thanks a lot for the help.

@Dmitry, yes it is working properly, I am just trying to find a way to retrieve the value of "PCName" displayed to query all related maintenance records and show these records in the lower grid:)