Home : Products : Hach WIMS : Hach WIMS Client : Documentation : Function Reference : Math Toolbox Functions : Daily Detail Functions : DDWHEN
Q10636 - INFO: DDWHEN

DDWHEN returns a daily value from a daily detail variable when another daily variable is at the Max or Min for the given day.

SYNTAX:

DDWHEN(Vx, VxCondition1, "Condition1 Stat", VxCondition2, "Condition2 Stat", VxCondition3, "Condition3 Stat")
where :
Vx is the variable to return a value from
VxConditionN is the variable to sort on, or check for the existence of a condition
ConditionN Stat sets the condition to check for. Options are "Max", "Min" or "" and must be in quotation marks

NOTES:

Only three conditions may be specified, but all three must be filled in.  The second and/or third condition is ignored if "ConditionN Stat" is blank ("").

EXAMPLES:


Example 1:

V81 = DDWHEN(V72, V73, "MAX", V73, "", V73, "")

Variable 81 will contain the hourly value of Variable 72 corresponding to the time period when Variable 73 is at its maximum for the day, as demostrated below:

As shown above, Variable 73 reaches its maximum of 1.96 at 5:00 AM.  The corresponding time slot of Variable 72 contains the hourly value of 8.56.  This value is then stored in variable 81.

Example 2:  Return V1 when V2 is at its daily Maximum

V7 = DDWHEN(V1, V2, "MAX", V1, "", V1, "")

Time V1 V2
00:00 0 4.5
01:00 1 3.2
02:00 5 6.7
03:00 3 4.0
04:00 - -
05:00 - -
... ...   ...
23:00 - -

Stores a value of 5 in Variable 7 for the date shown above (value at 02:00) since the max value of V2 occured at 02:00.
If there are two or more values that are the maximum, the function returns the value corresponding to the first Max value, as demonstrated below:

Time V1 V2
00:00 0 4.5
01:00 1 3.2
02:00 1 6.7
03:00 3 6.7
04:00 2 4.3
05:00 - -
... ...  ... 
23:00 - -

Stores a value of 1 in Variable 7 for the date shown above (value at 02:00) since the first max value of V2 occured at 02:00, even though there is a matching maximum at 03:00.

Example 3: Return V1 when V2 is at the Max.  If there are 2 or more max values, look at those times and return V1 when V3 is at the minimum.

V7 = DDWHEN(V1,V2,"MAX", V3, "MIN, V1, "")

Time V1 V2 V3
00:00 0 4.5 48
01:00 1 3.2 63
02:00 5 6.7 37
03:00 3 6.7 11
04:00 - - -
05:00 - - -
... ... ... ...
23:00 - - -

Stores a value of 3 in Variable 7 for the date shown above (value at 03:00) since the max value of V2 occured at 02:00 and 03:00 and between those two times, V3 was at its minimum at 03:00.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 1/18/2008 3:12 PM.
Last Modified on 3/23/2010 1:29 PM.
Last Modified by Scott Dorner.
Article has been viewed 2872 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article