I need a reference to a text item in a other collection, see below
'labels': collection ['label'] {
'label': text
'label2': text
}
'names': collection ['name'] {
'name': text
'name2': text -> ^ .'labels'.'label2'
}
The last line gives an error, how can I get a reference to label2
?
In Alan, text references point to collection entries. To unambiguously reference a collection entry, the value of a text reference should always be a key value: label
in your code sample. To show additional values like label2
in the GUI, you can do this:
'labels': collection ['label'] {
'label': text
// use @identifying to always show the label2 value
// at label references in the GUI
'label2': text @identifying
}
'names': collection ['name'] {
'name': text
// use @show: to show the value of label2 in addition to
// the keys of labels (obsolete when using @identifying)
'name2': text -> ^ .'labels'[] @show: (
'label2': text
)
}