Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Help with Computed Column
KSReynolds
<p>I am on a huge learning curve.....What should be so simple seems overwhelming. I just want to add a simple computed column. </p>
<p> </p>
<p><b>if</b> (row["Main_Was_Rejected"]="yes")</p>
<p>row["Main_Rejection_Reason"]</p>
<p><b>else</b></p>
<p>{"No"}</p>
<p> </p>
<p> </p>
<p>If Main_Was_Rejected = "Yes", then I do get the "Main_Rejection_Reason"</p>
<p> </p>
<p>But if it does not equal "Yes", my answer is blank.</p>
<p> </p>
<p>What am I doing wrong and is there a good place to reference computed column syntax as I am going to have to do nested if statements.</p>
<p> </p>
<p>Thank you.</p>
<p> </p>
Find more posts tagged with
Comments
Matthew L.
<p>Try the following:</p>
<p> </p>
<p>if (row["Main_Was_Rejected"] <span style="color:#ff0000;">=</span>= "yes")<span style="color:#ff0000;">{</span></p>
<p> row["Main_Rejection_Reason"];</p>
<p><span style="color:#ff0000;">}</span> else <span style="color:#ff0000;">{</span></p>
<p> "No";</p>
<p><span style="color:#ff0000;">}</span></p>
<p> </p>
<p>Also this makes a Case Sensitive comparison.</p>
<p> </p>
<p>To make it work for any Case such as: "yes", "Yes", "YeS", "yEs",....</p>
<p>Use the following:</p>
<p> </p>
<p>if (row["Main_Was_Rejected"].toUpperCase() <span style="color:#ff0000;">=</span>= "YES")<span style="color:#ff0000;">{ </span><span style="color:#008000;">//.toUpperCase() will make the string CAPITAL</span></p>
<p> row["Main_Rejection_Reason"];</p>
<p><span style="color:#ff0000;">}</span> else <span style="color:#ff0000;">{</span></p>
<p> "No";</p>
<p><span style="color:#ff0000;">}</span></p>
KSReynolds
<p>You have made my weekend! I can use this example to build on, thank you so much.</p>
Matthew L.
<p>Glad to help.</p>
<p>Also for additional pointers, computed columns can use JavaScript to create these types of conditional statements.</p>
<p>A good resource for JavaScript is <a data-ipb='nomediaparse' href='
http://www.w3schools.com/'>http://www.w3schools.com/</a></p>
;
<p>For more information about the .toUpperCase() command see: <a data-ipb='nomediaparse' href='
http://www.w3schools.com/jsref/jsref_touppercase.asp'>http://www.w3schools.com/jsref/jsref_touppercase.asp</a></p>
;