Relations work only when associated with a form?

I duplicated a foundset for an “assessment” table, then found records flagged with an integer (boolean) field.

I wanted to show the (related-one) student names in a dialog, but the console always shows them to be undefined,

=>fsAsmtLock.asmt_student_id
212F4979-76B5-4A41-9784-DB2921C087FF
=>assessment_to_student.std_name_last
"Error during evaluation:TypeError: Cannot read property "std_name_last" from "

asmt_student_id is the foreign key, and assessment_to_student is the relation (inner join). The link for the two records is definitely there. Does the relation fail to locate the associated record when it’s a duplicated foundset?

Thank you,
Don

what is " fsAsmtLock"
is hat the foundset of assessment?

if so then you need to get the relation through that foundset:

fsAsmtLock.assessment_to_student.std_name_last

Yes, you are correct, fsAsmtLock is a duplicated foundset in the assessment table:

fsAsmtLock = forms.assessment_browse.foundset.duplicateFoundSet()

Here is what happens in the interactive console. There is definitely a foreign key, but the relation does not generate the result:

=>fsAsmtLock.asmt_student_id
212F4979-76B5-4A41-9784-DB2921C087FF
=>fsAsmtLock.assessment_to_student.std_name_last
Undefined
=>assessment_to_student.std_name_last
"Error during evaluation:TypeError: Cannot read property "std_name_last" from "
=>

Here is what I did to get around the problem:

infoText = 'Some student records that are associated with '
infoText += 'locked IEPs. \r\r'
for(i = 1 ; i <= lockedIEP_CT ; i++) {
	fsAsmtLock.setSelectedIndex(i);
	sql_query = "SELECT student.std_name_last, student.std_name_first FROM student WHERE student.std_student_id =  \'" + fsAsmtLock.asmt_student_id  + "\'";		
	var dsLocked = databaseManager.getDataSetByQuery('selpa_mgr_sql',sql_query,null,-1);						
	infoText += ' - ' + dsLocked.getValue(1,1) + ", " + dsLocked.getValue(1,2) + "\r"  // row, col; should be only one row
}
infoText += '\r' + 'For this reason the deletion cannot proceed (no action taken). '
globals.UTIL_alertDlg(infoText, 'Cannot delete...', null) ;

It would be very useful to know why the relation isn’t giving me what I wanted. I’ve attached a picture of the relation definition.

Thank you,
Don

In your relation you must define the right foreign key field ‘asmt_student_id’ instead of ‘asmt_assesment_id’!

Also verify if both columns have the same type and if one has for example the UUID converter set and the other doesn’t…

Thank you for finding my screw-up. Here it is as it should be (many → one).

Don