From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display maximum value

Hi! I have a program connected to a database. It reads the database and displays the contents in a table and in a graph. The point is that I want the maximum value obtained on each day to appear on the graph. Can you help me?

 

Inês

0 Kudos
Message 1 of 8
(1,925 Views)

Hi inescruz,

 


@inescruz32 wrote:

I want the maximum value obtained on each day to appear on the graph.


Read the data for "each day" from your database, then determine the max value.

Put those max values in an additional plot of your graph…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(1,919 Views)

Hi GerdW,

 

I have the data organized in this way in the database. I want the program to get the maximum value for the different days. Then I want the value and the respective date to appear on the graph.

0 Kudos
Message 3 of 8
(1,908 Views)

Hi inescruz,

 


@inescruz32 wrote:

I want the program to get the maximum value for the different days.


Use a loop to iterate over your days:

  • Then read data from your database by selecting the data for one day.
  • Get the maximum of the data of that day.

There surely is a "SELECT" command suitable for your database…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(1,889 Views)

Hi GerdW,

 

Can you explain to me how I can do this iteration, please? 

 

Best regards,

Inês

0 Kudos
Message 5 of 8
(1,559 Views)

Something like this:

SELECT MAX(column) from TABLE where date=....

https://www.w3schools.com/sql/sql_min_max.asp

 

If you dig further you can probably create a SELECT command, that gives you the MAX value for each day of e.g. one month.

 

Regards, Jens

 

Kudos are welcome...
Message 6 of 8
(1,557 Views)

Google "query maximum per day"

 

For instance: sql server - SQL query to get maximum value for each day - Stack Overflow

 

It will depend on the database. SQLServer SQL isn't Access SQL.

 

If you want a specific day (or if you know all days from a previous query), you can do something like:

 

SELECT TOP 1 value FROM data WHERE date>start AND date<end ORDER BY date DESC

 

Each part of this query is highly googleable.

 

There's also the max clause:

 

SELECT max( value ) FROM data WHERE ...

 

Again, google is your friend here.

0 Kudos
Message 7 of 8
(1,527 Views)

Hi JensG69,

 

I changed my block diagram and put up a dial that says what the maximum force was. Through the table, can I ask the labview to read it and tell me what is the maximum value for each day and show those values in a graph?

 

Regards, Inês

 

inescruz32_0-1627719103806.png

 

0 Kudos
Message 8 of 8
(1,386 Views)