Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unknown Value for Mandatory field 1

Status
Not open for further replies.

annettesue

Technical User
Feb 10, 2003
29
MY
hi, i m using a joined SDO to create my SDB and SDV in progress dynamics environment. I've this error message prompted while adding or copying a record when running my container/prog.
&quot;<tablename>.<fieldname> is mandatory, but have unknown(?) value.&quot;
The <tablename.fieldname> is not from the main table but from the table join with the main table. Is there anything to do with the PLIP because i m using PLIP to get the value from the same table and other table?

please advise.

Thanx in advance.

regards,
annette
 
Annette,

The problem is not in your PLIP, it's with the joined SDO. If you do AddRecord or CopyRecord, Progress will add or copy both records (the main table and the joined table). I'm assuming this is not what you want. The solution is to build an SDO with just the table you want to update. If you want to include some information from another table for display purposes, put it in a calculated field in the single-table SDO and display the calculated field in your SDB and/or SDV.

Mike.
 
Mike,
I tried to use the calculated field but i've encounter few problem. If there is no record in the table, error messages will prompt, such as:

- **No record is available (91)
- Unable to extract BUFFER-VALUE for field<fieldname>.(7366)
- Unable to update RowObject Field.(142)
- Unable to set attribute BUFFER-VALUE in widget of type BUFFER-FIELD.(3131)

Beside that, the calculated field display a &quot;?&quot; in the SDB/SDV eventhough i've manage to get the value.(i've checked the value, is correct).


regards,
annette

 
Annette,

Need more info.
Bring up your SDO in the AppBuilder.
Double-click on it to display the Property Sheet.
Click the Fields button to display the Column Editor.
Highlight your calculated field in the selection list.
Click the Edit button to display the Calculated Field Editor.
Tell me what you've put in the Expression editor widget.

Mike.
 
Mike,
there is no way for me to click the &quot;edit&quot; button. What I've done is I use a Browser Procedure and get the value from there. (I followed the progress programming handbook.)

There are 4 sections as follow:


/* definition */


DEFINE VARIABLE gcfields AS CHARACTER NO-UNDO.
DEFINE VARIABLE gchandles AS CHARACTER NO-UNDO.
DEFINE VARIABLE ghBuffer AS HANDLE NO-UNDO.


/* initializeObject */


DYNAMIC-FUNCTION(&quot;setScrollRemote&quot; IN TARGET-PROCEDURE,TRUE).

RUN SUPER.

{get DisplayedFields gcFields}.
{get FieldHandles gcHandles}.
{get QueryRowObject ghBuffer}.


END PROCEDURE.

/* rowDisplay */

DEFINE VARIABLE pc_name AS DECIMAL NO-UNDO.

RUN SUPER.
IF VALID-HANDLE(ghBuffer) THEN DO:
pc_custname = widgetValue('finame').
ghBuffer:BUFFER-FIELD('finame'):BUFFER-VALUE = pc_name.

END.

END PROCEDURE.

/* function widgetValue */
RETURNS CHARACTER
( /* parameter-definitions */
pcColumn AS CHARACTER ) :

DEFINE VARIABLE hField AS HANDLE NO-UNDO.
IF VALID-HANDLE (ghBuffer) THEN DO:
hField = ghBuffer:BUFFER-FIELD(pcColumn).
RETURN STRING(hField:BUFFER-VALUE). /* Function return value. */
END.
END FUNCTION.

annette.
 
Annette,

You've over-complicated the task. If your calculated field has been set up in the SDO your browser will see it as just another field in the RowObject temp-table and you can pick it for display just as you would with a regular database field. You can't edit this field from the Smart Browser but you CAN edit it from the SDO. From your earlier post, which procedure was giving you the &quot;No record is available&quot; error and what did you do to check that the calculated field value was correct ?

Mike.
 
Mike,

Am I? If not, how am I suppose to do? I can't find a more simpler way of doing it.
The procedure that gives me those messages is 'initializeObject' for Browser. All the messages will prompt out if there is no record in the table when I tried to run the programme.
I prompt a message for the value I get using something like;
&quot;MESSAGE widgetValue('finame') VIEW-AS ALERT-BOX&quot;, and it's showing the correct one.
Can you tell me how to edit in the SDO, I really can't find the way. Thanx.

annette.
 
Annette,

Okay, back to basics in the SDO. Here's an example of the simplest method for inserting a calculated field into an SDO. For this example you need to be in an AppBuilder session and connected to the Sports or Sports2000 database, and you need to have built a basic SDO for the Employee table. One of the fields in the Employee table is DeptCode and the calculated field we're going to build will contain the corresponding department Name.

Firstly, in the Section Editor create a new Function GetDeptName and make sure it returns CHARACTER. Give it an input parameter pcDeptCode, and put the following in the function:
Code:
DEFINE VARIABLE cDeptName AS CHARACTER NO-UNDO.

FIND Department WHERE Department.DeptCode = pcDeptCode NO-LOCK NO-ERROR.
RETURN (IF AVAILABLE Department THEN Department.DeptName ELSE &quot;&quot;).

Now display the SDO's Property Sheet, click the Fields button to display the Column Editor, and click the Calculated Field button to add a new field in the Calculated Field Editor. In the Expression editor widget enter:
Code:
GetDeptName(RowObject.DeptCode)
Click OK to return to the Column Editor. On the right-hand side you'll see the Name of the field is CALC. Change this to cfDeptName, and change the Format from x(8) to x(15) so that it matches the format of Department.DeptName. Click OK to return to the Property Sheet and click OK again to close the Property sheet.

Go back to the Section Editor and click the List button. You'll see that the AppBuilder has generated a new procedure DATA.CALCULATE. The code in this procedure should read:
Code:
      ASSIGN 
         rowObject.cfDeptName = (GetDeptName(RowObject.DeptCode))
      .
Save the SDO. You can now use RowObject.cfDeptName in a Smart Browser or Smart Viewer just like you can any other RowObject field.

This isn't the only method for creating calculated fields but it should be enough to get you going.

Anyone want me to tidy this up and post it as an FAQ ?

Mike.

 
Mike,

May I know where is the Expression editor widget? Is it in the SDO's Column Editor? In the previous version of progress(9.1D), I know we can edit the calculated field from the SDO. I am not sure will the procedure DATA.CALCULATE be generated in progress dynamics?

annette.
 
Annette,

In the SDO's Column Editor there's a selection list down the left-hand side showing all the fields in your SDO. Below that there are 2 buttons -- Calculated Field... and Edit... You press the Calculated Field button to create a new calc field or you highlight an existing calculated field in the selection list and press the Edit button to change it. Either way, you get a dialog box titled Calculated Field Editor. At the top of this dialog box there's a text box (editor widget) labelled Expression. In the example I gave earlier this is where you would put
Code:
GetDeptName(RowObject.DeptCode)
It's the same in both Dynamics and plain old ADM2, and in both cases, when you OK out of all these dialog boxes Progress generates the DATA.CALCULATE procedure. Dynamics automatically calls this procedure at the right times to populate your calculated field(s).

Mike.
 
Mike,

I've tried several times, but when I added the calculated field, the 'edit' button still disabled. How do I get the dialog box titled Calculated Field Editor? It is from the SDO?

By the way, do you know the reason why when there's no record in the table, with a calculated field added, messages as above mentioned will display? Do you know how to solve the problem?
The messages prompted as below:

- **No record is available (91)
- Unable to extract BUFFER-VALUE for field<fieldname>.(7366)
- Unable to update RowObject Field.(142)
- Unable to set attribute BUFFER-VALUE in widget of type BUFFER-FIELD.(3131)


regards;
annette.
 
Annette,

Which version of Dynamics are you running ? I've only tested on V1.1A and Progress V9.1D06. If you're on V2 of Dynamics there may or may not be some differences, and I'd suggest a call to Tech Support.

Mike.
 
Mike,

I'm running on V2.0. Really appreciate your help.
Thanks for your advice. I'll try to figure out why the messages prompted before taking any action.

annette.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top