Disable Link based on record exist

Disable Link based on record exist

  
I have 2 links, Edit Record and Add Record, I want to disable the Edit link if a record is Null, or disable the Add link if the record exist, im sure it is performed in the preparation screen, but not sure how to access the links enable property to create the true/false logic.
Never mind, I wasnt thinking... easy enough, I created a boolean expresion in the enable property of the link checking if the record exsist (record.Id = NullIdentifier())


False Alarm... Im trying to find something to get help on hahaha, most everything follows simple logic. 
Hi Jim,

Your question was a common one. Those who have a background in languages like .Net or Java and are used to develop ASP.Net applications (I'm assuming you fit this), are used to a procedural way of doing things:
  • On Page_Load you prepare common data for a page and may access control instances, and set it's properties (create a class variable and fill it from some request variable - Ex: Customer myCustomer = Customers.FindCustomer(this.Request["QueryStringParameter"]));
  • Usually that is done after some initialization provided by the designer (Visual Studio Windows Forms automatically create a InitializeComponents() function with all the code to create buttons and place them, Web Forms follow a similar lifecycle)
  • On Page_PreRender or Page_Render you usually set properties of controls with some values you've calculated during the page lifecycle or even while you assign (Ex: Button1.Enabled = myObject.AllowedForThisCustomer(this.Customer.Id)
On OutSystems we simplify this a bit (a "big bit") and you basically endup with
  • Screen local parameters (somethig like myCustomer)
  • ...that you load in Preparation (something like Page_Load) : Assign myCustomer to a GetCustomer builtin action that receives parameter QueryStringParameter (which by the way is an input parameter to the screen)
  • Then you work via control properties: instead of using the actions to set screen properties, you'll use the properties to access screen variables (set Enabled property to a User Function that calculates the boolean Enabled/Disabled (ObjectAllowedForCustomer(myObject, GetCustomer.Record.Id). This is just like assigning the properties during Page_PreRender