We have an audit database that has an “In compliance?” field for approx. 30 questions. If the answer is No on the last audit, and the answer to the same question is No on the next new audit, the “Repeating Item” field should fill in an “X”. We have a “Prior Audit” view sorted by store, then audit date, so the most current is always first in the view. View also includes the doc UNID. In the form is a field named GetMe with this formula:REM {If this is a draft, it’s OK to update values based on last audit. Once it’s been finalized, don’t change GetMe};
@If(Status = “1”;
@Do(
@Set("temp";@DbLookup("";"";"vwPrior";@UpperCase(@Name([CN];Store));3));
@Set("temp2";@If(@IsError(temp);@Return("");@If(Store != "";@Subset(temp;1);"")));
@Set("temp3";@If(temp2 = @Text(@DocumentUniqueID);@Subset(temp;2);temp2)));
@Set(“temp3”;GetMe));
@If(GetMe = “”; temp3; GetMe)
The field that is supposed to get the “X” has this formula: (“C” is the “In Compliance?” field, “R” is the field receiving the X)
REM {If the doc unid in GetMe is no longer valid because the document was deleted or archived or whatever, we need to work around that};
fldNo := @Right(@ThisName;@Length(@ThisName)-1);
temp := @GetDocField(GetMe;“C” + fldNo);
@If(
GetMe = “”;@Eval(“R” + fldNo);
@IsError(temp);@Eval(“R” + fldNo);
temp = “No” & @Eval(“C” + fldNo) = “No”; “X”;
“”)
Getting the “X” to populate has been iffy at best; sometimes it works great and sometimes it fills in only some of the questions that should get an “X”. All of a sudden now it doesn’t work at all. I’ve worked with the other developer here on this and we’re fresh out of ideas. Any help would really be appreciated. I hope I’ve given enough information. TIA