Force field update

Hi,

I am looking for the best way to update a computed field.

In a document, the calcul of this field was wrong. So I wanted to update it. I can not do it via the form because it is a computed field

How can I do that ? Do I have to write a script especially for that ?

thanks in advance

luc

Subject: force field update

I don’t undestand. Why can you not let the field on the form compute? Will the result always be wrong? Is this a one-time thing?

You say you want to “update” it. Please explain.

If the form is not opening because the results of the field are returning an error, write an agent to set the field to “” (or zero for a number field) then open and refresh and save.

Will that work for you?

  • Matt

Subject: RE: force field update

Thanks all for answering,

Matt => my problem deals with fields computed at creation (like the date of creation, the number of the document…). So I can not do a refresh.

A bug has probably appeared during the creation of 2 documents. I haven’t found the reason of this bug yet.

The consequence is that computed fiels have not been computed during the creation of theses 2 documents (the database contains 2000 documents).

So I wanted to be abble to modify theses fields.

I will probably use the script given in the first answer. (thanks for it).

I should probably create a second topic in the forum so as to find help to solve the problem, but here is the detail :

In PostOpen script, I have several computed fields that are initialized like mydate=now() or also mynum= num+1 (where num comes from a unique document that contains a counter increase at each document’s creation)

For 2 documents, none of these fields has been initialized.

I am looking for the reason.

The script is quite simple and that made two years that 200 persons use the database.

When I have created the database, I decided to computed these fields via the PostOpen script, so I have put a nonuse value (“1” in my case) in the value attribut of each field.

luc

Subject: force field update

I have an agent which does it for me. Create a agent which can run on selected document. Copy the code below and follow the comments. Hope this helps.

REM {

Name: SelectiveFieldFix

Location: Agent

Purpose:

The purpose of this agent is to enable user to replace a single field value in a document without opening to document. This agent is able to edit a text or numeric field. User will be asked the type of data type to edit and then the field name and lastly the value to update.

Note* Please use exact field name as the agent will create a new field using the field name entered if the fieldname entered does not exists.

};

DataType := @Prompt([OkCancelEdit];“Date Type”;“Please select the data type. N=Numeric and T=Text”;“”);

fieldName := @Prompt([OkCancelEdit];“Field Name”;“Please input the field name that is to be updated”;“”);

fieldValue := @Prompt([OkCancelEdit];“Field Value”;“Please input the updated field value”;“”);

@If(DataType = “N”;@SetField(fieldName;@TextToNumber(fieldValue));@SetField(fieldName;fieldValue));

SELECT @All

Subject: force field update

create a smart icon with the following code:

@Command([ToolsRefreshAllDocs])

you may also choose to use [ToolsRefreshSelectedDocs] to act on only selected documents. Look them up in designer help for full details.