Skip to main content
Question

Combined field for related fields?

  • February 4, 2020
  • 0 replies
  • 37 views

Forum|alt.badge.img+14
Many times when I have two different related fields pulling in information, if I want to display it more simply on a report, I will simply make a formula text field: totext([Field 1) & totext([Field 2]). 

In this case, I have two related fields, lets call them Related Parts and Related Pieces. In each case, there will be only EITHER a related part or a related piece.

Is it possible to make one field that will display which ever one it is, plus link to it? Essentially, doing what I showed above but not displaying as text - instead displaying as their name with link still live. 



------------------------------
Mike Tamoush
------------------------------

  • Registered
  • February 4, 2020
Hi Mike, 

The way that you can accomplish this is to create a formula Richt Text field.  You would create an if statement where the condition is what determines whether the [Related Parts] will be shown or [Related Pieces].  Then, as far as I know, you would need to create an anchor tag to create the link.  The following is an example:


var text displayValue = if([Condition] = true, [Related Parts Proxy], [Related Pieces Proxy]);
var number recordID = if([Same Condition as above] = true, [Related Parts], [Related Pieces]);
var text tableID = if([Same Condition as above] = true, [_DBID_Parts], [_DBID_Pieces]);
var text URL = URLRoot() & "db/" & $tableID & "?a=dr&rid=" & $recordID;

"<a href='" & $URL & "'>" & $displayValue & "</a>"

------------------------------
Brandon Drake
JHI Group
Monroeville OH
------------------------------