No read access to non-existent attribute

0
Hello! I’ve come across a really strange problem. I’m working on an online exam system and would like the button “Next Question” to be visible for all questions except the last. I have a DataView of the current Question and nested in it a DataView of the Test to which the question belongs. My visibility expressions is such: $TestQuestionDataView/Number < $currentObject/NoOfQuestions (where $currentObject is of type Test) I am getting the following error: No read access to attribute 'Number' in entity 'TestManagement.Test' for user role 'Student' (with role 'Student' in module 'TestManagement'). Condition for visibility of action button … There are two problems. First, user role Student has read access to all fields of both entity types (Test and TestQuestion). Second, there is no attribute Number in entity Test. Is this some kind of a bug? 
asked
8 answers
1

In your case the error indeed seems incorrect, but it might point you in the direction of what’s going on:

- Where is the visibility expression located (maybe add a screenshot of the page in the modeller)?

- Have you checked if the currentObject is actually of type Test?

- Is the module role Student connected to the project role?

 

answered
1

Hi and thanks for the answer! 

I’ve checked all that you listed before posting but in case you see something I don’t, here are the screenshots:

answered
1

Since 8.1.1 is not an LTS release (LifeTime Supported), upgrade to the next available LTS-release, currently 8.6.2, is a good idea anyway. I do however not expect this error to be gone in 8.6.2 but browse the release-notes, maybe a solution for some possibly related bug is implemented.

You might try to move the buttons out of the dataview’s footer and place it in the dataview itself, just below the TestAnswer listview. At that place the TestQuestion.Number should be available.

answered
0

The error text is probably indeed a mendix bug where {2} is referring to the currentobject instead of to the correct error-throwing object, the question. you might report it to support.mendix.com

My next step in trying to find the root cause would be to add the TestQuestion/Number and the Test/NoOfQuestions before the ‘Next Question’-button in order to see if they show up.

And you want to know if it is a data-generated problem. So: you don’t get this error in the previous questions? Do all test have this problem. Also if they have a totally different last question.

answered
0

I agree with Tim, it looks like a Mendix bug, you can report it to support.mendix.com

 

Another check you might want to add in the expression: check if either one isEmpty, because if either side of the expression (Number or NoOfQuestions) is null (empty) it might not evaluate properly. This was at least the case a few versions ago (not sure if this has been changed in Mx 8.1)

answered
0

None of the values are null/empty, so that’s not an issue. However, it seems to be the problem of scope. Although the expression editor gives me the option to use the all-encompassing DataView, it seems that it’s actually not accessible (by bug or design, I don’t know). If I add the TestQuestion/Number to the form, I get an error like in the picture below:

Now the question is – should this attribute be visible at all in the internal DataView? If no, should it be available in the expression editor? If the answer to the second question is again no, then I have to add another field to the database and keep track of the student’s moving through the exam all the time, instead of just using already available attributes I have on the form.

Do you think upgrading to a newer version would help?

answered
0

Upgrading to 8.7.0 helped, now Studio Pro no longer shows an error.

Just a note to one of the previous responses – it can’t be a data related issue, as this never gets out of Studio Pro. The error is in the processing of the form, not in runtime.

answered
0

Thanks for the suggestion, I’ve already tried it (check latest screenshot) and it didn’t help. Upgrade to 8.7.0 did :)

answered