2018年5月31日 星期四
Excel判斷空白
有些欄位數值要改掉,
有資料的才改,沒資料的不用改。
正常的思維,
用
"update item set ror_pot="& A1 &" where item_no ='"&TRIM(A1)&"'"
串出來要改的SQL語法
會像這樣
update item set ror_pot = 1 where item_no=’123456’
但如果 A1 是空白,那指令會變成
update item set ror_pot = where item_no=’123456’
那就錯了,當然可以選擇一個一個砍。
但身為一個 懶人
一個一個砍好累,我不想。
用IF自動判斷一下是不是空白吧。
=IF(NOT(ISBLANK(R9)),"update item set ror_pot="& R9&" where item_no ='"&TRIM(A9)&"'","")
判斷空白
ISBLANK
否定句
NOT
全部加起來就是
假如不是空白,就湊出SQL。
2018年5月29日 星期二
JSP表格排列
電子表單撈出來的程式,
是jsp,但今天要針對表格作排列的話。
一種就是針對資料排列,排完後就直接列印啥都不用管。
看了一下JSP的排列方式,要麻用 treemap 再不然就是用 Vector 然後我都弄不出來。
最後只好改用前端的方式作。
於是 Sort a Table
就這樣直接套用了。
<script>
//根據單號排序
var table, rows, switching, i, x, y, shouldSwitch;
table = document.getElementById("myTable");
switching = true;
while (switching) {
switching = false;
rows = table.getElementsByTagName("TR");
for (i = 1; i < (rows.length - 1); i++) {
shouldSwitch = false;
x = rows[i].getElementsByTagName("TD")[1];
y = rows[i + 1].getElementsByTagName("TD")[1];
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
shouldSwitch = true;
break;
}
}
if (shouldSwitch) {
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
}
//console.log('loop');
}
</script>
x = rows[i].getElementsByTagName("TD")[1];
後面的 [1] 是代表table的第二個column,表格是從0開始
table ID 是 myTable
標題記得改用TH
2018年5月16日 星期三
PowerShell 檢查硬碟狀態發送line通知
但一消失,HV虛擬機器就掛了..
某天(也就是昨天),突然想到應該可以用powershell寫一下判斷,再發個mail通知一下。
早上就開始拼拼湊湊,最後生出來了。
下面的程式中,有些驗證的地方請自行輸入,
line_Notify的authorization,可以去看前面的文章。
line_bot 有用過的人,應該就知道了,沒用過的,表示你目前還不需要
詳細說明請看最後面。
2018年5月7日 星期一
PowerBuilder 看不到註解(comments)
裝了那麼多次,第一次碰到打開看資料表
沒有註解,要把全部欄位背起來太困難了。
所幸,萬能的google,找到這篇
Viewing table data types, comments, keys, and indexes In the Object Layout view, you can see a description for each column, as well as icons for keys and indexes. If you do not see this, right-click a blank area inside the view and select Show Comments, Show Referential Integrity, and then Show Index Keys from the pop-up menu. If you select Show Datatypes, you also see the data type for each column in the selected tables.
簡單說就是,在空白的地方按右鍵,顯示comments就好了
人生終於從黑白跑到彩色
2018年5月6日 星期日
2018年5月4日 星期五
快速使用Line Notify
Line Notify 跟 Line Bot的差別,如要看其他功能,請參考
Line Notify(API) | Line BOT(Messaging API) |
無法互動 | 可互動 |
免費 | 使用API要錢(連結) 可申請測試 |
文章開始,
這篇就跟標題一樣,快速建立一個訊息發送到自己的LINE用。
文章是 參考 這篇
2019/04/10 《補充》 要換行的話,輸入 %0D%0A
1.申請 Line Notify
https://notify-bot.line.me/zh_TW/