Fetch and lookup fields

Fetch and lookup fields

Hi all,

I'm relatively new to Creator and am struggling to fetch a record from a linked form and return a field value as text. If anyone could advise where I'm going wrong below then it'd be greatly appreciated - I've tried to explain what I am hoping to achieve in the code.

x = Role_link[Personality_email == zoho.loginuserid].Role_name;

// go to Role_link form and find theentry where the Personality Email (single line of text, not lookup) matches the logged in user email.
//  N.B. 'Role_name' is a lookup field from the 'Role' form
// Return the ID of the lookup record in the Role_name field from the Role form


y = Role[ID == x].Role_Name;
// go to the Role form and find the record that matches Role_name entry 
// return the contents of the Role_name field as a single line of text

if (y = "Data Inputter")
{
hide Hazard_peer_checked;
}

I'm receiving no errors, it just isn't hiding the field. I'm then scripting: 

'else { alert x}'

...to see what it is finding during the first part of the workflow and it is returning an alert of 'null'

Any helpful pointers appreciated.

Dave