Wednesday, February 26, 2014

SSIS: Derived Column

Add in Expression column
If single if else
(Active ==  0  ? "IAmNotActive" : "IamActive")
Where active is column name.

Second when you have multiple account:

(Age< 20 ? 1 :
(Age>= 20 && Age< 30 ? 2 :
(Age>= 30 && Age< 40 ? 3 :
(Age>= 40 && Age< 50 ? 4 :
5))))

means if (Age< 20){1}
else if (Age>= 20 && Age< 30) {2}
else if (Age>= 30 && Age< 40) {3}
else if (Age>=  40 && Age< 50 ){4}
else {5}
Where Age is column name

Wednesday, February 19, 2014

Prevent table row onclick event to fire when clicking button inside the row

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   <script type="text/javascript">
      function test(e) {
         alert('button');
         e.stopPropagation();
      }
   </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <table border="1" cellpadding="0" cellspacing="0">
          <tr onclick="javascript:alert('li')" style="cursor:pointer">
             <td>
             <input  type="button" onclick="test(event)" value="click me" />
             </td>
             <td>ll</td>
          </tr>
       </table>
    </div>
    </form>
</body>
</html>