Hi, I am using the following code for a custom view. Basically, if the active record has a "Status Code" of 2 or 6 and the "End Date" field for that same "Status Code" is 0000-00-00 or NULL then I want to see the No, otherwise Yes
if ($_SESSION["language"] == "French") {
if (($data['Status_Code']=='2' OR '6') AND
(($data["EndDate"] == '0000-00-00') OR ($data["EndDate"] == NULL))) {
$value = "Non";
} else {
$value = "Oui";
}
} else {
if (($data['Status_Code']=='2' OR '6') AND
(($data["EndDate"] == '0000-00-00') OR ($data["EndDate"] == NULL))) {
$value = "No";
} else {
$value = "Yes";
}
}
As long as there is only one "Status Code" record linked a single person everything works fine. As soon as a new one is added this fails over to the default of YES regardless.
As this database grows there could be a history of "Status Code" changes that needed to be tracked.
I suspect the error with this formula is that it is not only checking a single status code record (ie record 1) but instead looking at every record linked to a person (ie record 1, 2 and 3).
So if I have the following
StatID MembID Status_Code StartDate EndDate
1 5 2 2014-10-31 0000-00-00
2 5 1 2014-01-01 2014-06-01
3 5 2 2014-06-01 2014-10-31
I am guessing my coding above will does not ensure that all of the validation is only applied to StatID 1 but instead mixes everything...
Any easy to add a quick code that will ensure that the code is only looking at a single row to validate?
Thanks!!