DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing channel values

Solved!
Go to solution

I was curious what the best way to compare or test values inside a channel is.

 

I have a channel with about 1000 values inside of it.  I copy/paste all the values into a excel spreadsheet.  What I would like to do is change the color of every cell that has a value from the channel less than 30 for example. 

 

 

0 Kudos
Message 1 of 10
(5,365 Views)

Hello aGrimm,

 

attached you get an example which shows how to define a user command to mark certain values of a channel. Unzip the file an run the script CustomFct_Init.VBS: If clears the Dataportal, loads the example dataset and registers the user command which colors certain cells depending of a condition. The layout shows a table which refers to the user command.

 

Greetings

Walter

0 Kudos
Message 2 of 10
(5,360 Views)

I don't think that was exactly what I was looking for.  I'm not really sure how that example is looking at the values inside the channels.  Also I would really like it to be in excel and each value would have a cell and then I could color that cell. 

 

Even if I had to go through a channel and pick out all of the values greater than 5 and make a new channel for those that would be more along the lines of what I want to do.  This or what I said above about coloring the excel cells.

0 Kudos
Message 3 of 10
(5,350 Views)

Greetings,

If I am understanding you correctly you are wanting to change the color of cells in excel based on the value displayed in the cell. Is that correct? If so, I would suggest looking in the excel help under "conditional formatting". Additionally, here is a microsoft article on the issue: http://msdn.microsoft.com/en-us/library/bb286672%28v=office.11%29.aspx

 

I hope this helps,

 

Product Support Engineer
National Instruments
0 Kudos
Message 4 of 10
(5,343 Views)

Yes that is more of what I want but still not quite.

 

So far this is what I have... I have a channel "Y" and a channel "X" with 1000 different values.  I copy and pasted these two channels into a excel spreadsheet.  What I would like to do is have a VBS look through the cells and change the color of the cell if it is over 5. 

 

Basically I have a large amount of data that I want a script to look through and change the color of the cell depending on a condition I give it.

 

 

0 Kudos
Message 5 of 10
(5,341 Views)

Is there a specific reason that you are wanting to use VBScript to accomplish this? It seems as though it would be easier to use the conditional formatting functionality. Perhaps I am misunderstanding something about the scope of your project. Otherwise, it certainly should be possible to use a vbscript to evaluate each excel cell and alter the color property. Please let me know.

Product Support Engineer
National Instruments
0 Kudos
Message 6 of 10
(5,337 Views)

Mainly because I would like to run the script and have it create the already formatted excel file.  That way I could just look at sheet and pick out the values that are different colors quickly. 

 

I guess I am open for either option if both are possible.  Not really familiar with DIAdem yet but everything up to this point has been done with a script.

0 Kudos
Message 7 of 10
(5,335 Views)
Solution
Accepted by aGrimm

Ah I see. So a script would be more useful because you intend to use a script to move the data into excel in the first place. So you could incorporate the color change into the script rather than having to go in and set up the conditional formatting each time.

 

Here's a link to a blog that shows an example of someone doing something similar to that.

http://blogs.technet.com/b/heyscriptingguy/archive/2005/06/29/how-can-i-change-the-background-color-...

 

I think it should be fairly simple to incorporate this into your script and make adjustments to check for a threshhold other than a date.

Product Support Engineer
National Instruments
Message 8 of 10
(5,306 Views)

Awesome!  That worked perfectly thank you very much.

0 Kudos
Message 9 of 10
(5,302 Views)

You are very welcome, glad I could help 🙂

Product Support Engineer
National Instruments
0 Kudos
Message 10 of 10
(5,300 Views)