ComputeWithForm not working

I have a scheduled LS agent that runs from the server. Its purpose is to populate fields on the Calendar form (in the mail database) with data retrieved from a .txt file on the network server. All that works fine.

The problem I’m having is that fields with “input translation” code (@Formula) are not getting translated when the agent runs and saves the documents. I can manually go to the now-populated form & manually save it, then the input translation code happens. I have read on this forum that ComputeWithForm is what is needed (which I do have in my agent), however, I’ve also read that ComputeWithForm does NOT work with the Calendar form. I have tried many different ways to make this work, but still no success.

I have the form property “Automatically refresh fields” turned on. Also noteworthy, I use this same code in a form I created from scratch, and the input translation DOES work programatically.

The field I’m using input translation just has names separated by semicolons. My input translation code simply replaces the semicolons with @NewLines. As I said, it works perfectly in non-Calendar forms.

Can anyone tell me how to “refresh” these particular fields, programatically?

I’ll be glad to post the code if necessary. Thanks so much, in advance (my head can’t take much more banging).

Dana

Subject: ComputeWithForm not working

Hello Dana,

why don’t you just put the right value into the field by validateing it in your code:

v=Evaluate(|@ReplaceSubstring(Field;“;”;@NewLine)|, doc)

doc.GetFirstItem(“Field”).Values=v

HTH

Regards

Christian

Subject: RE: ComputeWithForm not working

Keeping @Formulas seperated from LS and not duplicating code sound like valid reasons for me. Even if the performance penalty of Evaluate isn’t an issue.

Honestly, I have no idea what might cause this to fail in the Calendar (the mail template IS special …), but I see two ways around the problem.

First, you could create a seperate “cfd” form for the calendar entry in question. Include only the field(s) that actually need recalculation. Then switch forms before and after ComputeWithForm.

Second, can’t this field be turned into a multivalue field? If so, you already have the display option to seperate values with new lines on the third property tab.

I assume, that this mail template is customized already, so changing more desing elements shouldn’t impose an additional issue.

Subject: ComputeWithForm not working

To be absolutely certain you know what is happening then its quite normal to put all input translation & validation into the agent. Yes, I know it duplicates code BUT you’re only looking in one place when debugging the agent.

Subject: RE: ComputeWithForm not working

Thanks so much for all your responses. I went with Christian’s suggestion and used ‘Evaulate’ in the LS agent. It works perfectly.

Much appreciated!!!