BlakeEstep
5 years agoQrew Trainee
View query record if single record otherwise view query list
I am creating some buttons in a Formula - Rich Text field. They will allow users to quickly jump from one table to the next using the table to table relationships we have set up.
Mainly what they will be seeing is a list of related records based on a query. For example, if I am in the Customers Table and I click on the Invoices button it will take me to the invoices table and I can see all the invoices related to that customer.
If there is only one invoice I would like the button to take me directly to that invoice record and not view it in list mode.
Is there a way to use the query and set up an if statement that would check the length of the query response and if there is only one then view that record.
Below is an example of the query code I am using for one of the buttons.
Mainly what they will be seeing is a list of related records based on a query. For example, if I am in the Customers Table and I click on the Invoices button it will take me to the invoices table and I can see all the invoices related to that customer.
If there is only one invoice I would like the button to take me directly to that invoice record and not view it in list mode.
Is there a way to use the query and set up an if statement that would check the length of the query response and if there is only one then view that record.
Below is an example of the query code I am using for one of the buttons.
URLRoot() & "db/" & [_DBID_INVOICES] & "?a=q&query=" & "{'6'.TV.'" & [Record ID#] & "'}"