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: perost
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)

Changed 7 years ago by jabozzo

comment:1 follow-up: Changed 7 years ago by 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.

Changed 7 years ago by jabozzo

Fix of duplicated classes

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

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 Changed 7 years ago by adeas31

  • Component changed from *unknown* to Frontend
  • Owner changed from somebody to perost
  • Status changed from new to assigned

comment:4 Changed 3 years ago by perost

  • Milestone changed from Future to 1.19.0
  • Resolution set to fixed
  • Status changed from assigned to closed

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.