Opened 7 years ago

Closed 3 years ago

#4623 closed defect (fixed)

Nested record cannot be used directly in a class.

Reported by: jabozzo@… Owned by: Per Östlund
Priority: high Milestone: 1.19.0
Component: Frontend Version: v1.13.0-dev-nightly
Keywords: Cc:

Description

When using a record, which in turns has an array of records, the fields of the records in the array cannot be accessed directly without the Check Model function complaining.

In the example, the record B contains instances of record A. Verbose, is a model which first extracts A from B (field z) and stores in a parameter named hack. Then hack fields (in this case, x) is accessed and stored in another parameter. Bug model in the other hand, access directly x through z, without intermediate variables and Check Model Complains.

Here is the output for each Check model.

[1] 22:54:48 Scripting Notification
Check of RecordUse.Verbose completed successfully.

[1] 22:54:52 Translation Error
Internal error Expression.subscriptExp failed on {{RecordBag.A(0.0, 0.0), RecordBag.A(0.0, 0.0)}, {RecordBag.A(0.0, 0.0), RecordBag.A(0.0, 0.0)}, {RecordBag.A(0.0, 0.0), RecordBag.A(0.0, 0.0)}}

[2] 22:54:52 Scripting Notification
Check of RecordUse.Bug completed successfully.

Attachments (2)

Example.zip (2.1 KB ) - added by jabozzo 7 years ago.
Example_fix.zip (1.1 KB ) - added by jabozzo 7 years ago.
Fix of duplicated classes

Download all attachments as: .zip

Change History (6)

by jabozzo, 7 years ago

Attachment: Example.zip added

comment:1 by anonymous, 7 years ago

recordBag uses "package.mo" name with models A and B inside and outside, which probably is invalid.
However OM should either load one A and B models (I'm not sure which one should be) or reject to load this "package.mo" with an error message.
Instead it loads and shows inside the same package two A and two B models, which is invalid.

by jabozzo, 7 years ago

Attachment: Example_fix.zip added

Fix of duplicated classes

in reply to:  1 comment:2 by jabozzo, 7 years ago

Replying to anonymous:

recordBag uses "package.mo" name with models A and B inside and outside, which probably is invalid.
However OM should either load one A and B models (I'm not sure which one should be) or reject to load this "package.mo" with an error message.
Instead it loads and shows inside the same package two A and two B models, which is invalid.

Sorry about that, somehow I got the code duplicated for each class in the package. I've deleted the rebundant code and updloaded the example again.

comment:3 by Adeel Asghar, 7 years ago

Component: *unknown*Frontend
Owner: changed from somebody to Per Östlund
Status: newassigned

comment:4 by Per Östlund, 3 years ago

Milestone: Future1.19.0
Resolution: fixed
Status: assignedclosed

This seems to have been fixed at some point, and now works with both the old and the new frontend.

Note: See TracTickets for help on using tickets.