Forum Discussion
PrashantMaheshw
4 years agoQrew Captain
OK I'm trying in plain English now :)
1. My table has tasks which can come from three parent - Project Mgmt or GAP Mgmt
2. I've to find the relevant parent and create RICH TEXT to point towards it
3. I feel that I'm repeating IF multiple times , and maybe there is an efficient way to do the formula below
----
// Name of the Parent
var text Words =If([Related Project]>0,[Project Name],If([Related goal action plan]>0,[goal action plan],If([Related Template]>0,[Task Template Name],"")));
var text pnametable = "brpsrk25s";
var text gapnametable ="brn96mjz5";
var text templatetable="brpsr2uua";
// For defining the table name
var text tablename = If([Related Project]>0,$pnametable,If([Related goal action plan]>0,$gapnametable,If([Related Template]>0,$templatetable)));
// for definging the which project
var number tablerecord = If([Related Project]>0,[Related Project],If([Related goal action plan]>0,[Related goal action plan],If([Related Template]>0,[Related Task Template])));
var text URL = URLRoot() & "db/" & $tablename & "?a=dr&rid=" & $tablerecord;
"<a href=" & $URL & ">" & $Words & "</a>"
------------------------------
Prashant Maheshwari
------------------------------
1. My table has tasks which can come from three parent - Project Mgmt or GAP Mgmt
2. I've to find the relevant parent and create RICH TEXT to point towards it
3. I feel that I'm repeating IF multiple times , and maybe there is an efficient way to do the formula below
----
// Name of the Parent
var text Words =If([Related Project]>0,[Project Name],If([Related goal action plan]>0,[goal action plan],If([Related Template]>0,[Task Template Name],"")));
var text pnametable = "brpsrk25s";
var text gapnametable ="brn96mjz5";
var text templatetable="brpsr2uua";
// For defining the table name
var text tablename = If([Related Project]>0,$pnametable,If([Related goal action plan]>0,$gapnametable,If([Related Template]>0,$templatetable)));
// for definging the which project
var number tablerecord = If([Related Project]>0,[Related Project],If([Related goal action plan]>0,[Related goal action plan],If([Related Template]>0,[Related Task Template])));
var text URL = URLRoot() & "db/" & $tablename & "?a=dr&rid=" & $tablerecord;
"<a href=" & $URL & ">" & $Words & "</a>"
------------------------------
Prashant Maheshwari
------------------------------
MarkShnier__You
Qrew Legend
4 years agotry this. unlike Excel you do not need to nest your IFs. One IF is enough.
Also the result if none of the conditions is true is blank or null so there is no need for the empty quotes for the "else".
// Name of the Parent
var text Words =If(
[Related Project]>0,[Project Name],
[Related goal action plan]>0,[goal action plan],
[Related Template]>0,[Task Template Name]);
var text pnametable = "brpsrk25s";
var text gapnametable ="brn96mjz5";
var text templatetable="brpsr2uua";
// For defining the table name
var text tablename = If(
[Related Project]>0,$pnametable,
[Related goal action plan]>0,$gapnametable,
[Related Template]>0,$templatetable);
// for defining the which project
var number tablerecord = If(
[Related Project]>0,[Related Project],
[Related goal action plan]>0,[Related goal action plan],
[Related Template]>0,[Related Task Template]);
var text URL = URLRoot() & "db/" & $tablename & "?a=dr&rid=" & $tablerecord;
"<a href=" & $URL & ">" & $Words & "</a>"
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
Also the result if none of the conditions is true is blank or null so there is no need for the empty quotes for the "else".
// Name of the Parent
var text Words =If(
[Related Project]>0,[Project Name],
[Related goal action plan]>0,[goal action plan],
[Related Template]>0,[Task Template Name]);
var text pnametable = "brpsrk25s";
var text gapnametable ="brn96mjz5";
var text templatetable="brpsr2uua";
// For defining the table name
var text tablename = If(
[Related Project]>0,$pnametable,
[Related goal action plan]>0,$gapnametable,
[Related Template]>0,$templatetable);
// for defining the which project
var number tablerecord = If(
[Related Project]>0,[Related Project],
[Related goal action plan]>0,[Related goal action plan],
[Related Template]>0,[Related Task Template]);
var text URL = URLRoot() & "db/" & $tablename & "?a=dr&rid=" & $tablerecord;
"<a href=" & $URL & ">" & $Words & "</a>"
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
- PrashantMaheshw4 years agoQrew CaptainThank You Mark,
I learned something new regarding nesting !
------------------------------
Prashant Maheshwari
------------------------------