Subject: Why formula did not get refresh upon data upload?
Hi Will,
Lets try going back to some basics to see if we can work this out:
I created a lookup view, called AccountView.
In my form budget, I created a field called AccountCode, which both “refresh field” and “refresh choices” are ticked.
Below this field, is AccountDesc Field with the following formula,
DEBUG STEP ONE… Manually type the value you expect to see in the field AccountCode into the field as a default vlaue or while the document is in edit mode.
Hit F9 while in the document to see if AccountDesc field refreshes as expected.
DEBUG STEP TWO
Change the AccountDesc field to be Text \ Computed For Display and make the following the formula.
lu := @DbLookup( “” : “NoCache” ; “” : “” ; “AccountView” ; AccountCode ;4 );
@If(@IsError(lu );“An Error Occurred”;lu )
Then place the lookup value into AccountCode and hit F9 to refresh the document. does this return a different result?
Try saving the document and reopening it. Does this bring up the correct values?
DEBUG STEP THREE
If either of the above worked then make sure your AccountDesc field is Text, computed. Check refesh fields on doc refresh option. Use the same formula as in Step two above. Try using F9. If that fails try doing a Control S (Save and see if the values change).
If none of the above work check your values are correct in the lookup view.
The issue is that the refresh only works after data being >uploaded, and I click the agent to refresh this document. >(Using 'ToolsRefreshSelectedDocuments)
What do you mean by uploaded? If you are loading Accountcode into the back ground doc using an agent then you will need to do a Doc Compute With Form or similar in the agent populating the docs to ensure all the values formulas are run. You may need to refresh the docs twice if there are lookups relying on fields which themselves are lookups.
DEBUG TIP … when using a DB lookup and debugging, don’t use the formula
@DbLookup( “” : “NoCache” ; “” : “” ; “AccountView” ; AccountCode ;4 );
@DbLookup( "A WHOOPING GREAT ERROR OCCURRED " + lu : “NoCache” ; “” : “” ; “AccountView” ; AccountCode ;4 );
So you can see the difference between errors and failures to find data in the view.
Also try ditiching all the formulas with two lookups such as
@If(@IsError(@DbLookup( “” : “NoCache” ; “” : “” ; “AccountView” ; AccountCode ;4 ));“”;@DbLookup( “” : “NoCache” ; “” : “” ; “AccountView” ; AccountCode ; 4 ))
and go to the lu := style I suggested. It may solve your problem wif it is a double refresh error.
HTH,
Shane