rdlc報表表示式應用 字串和轉換

2022-09-18 00:06:23 字數 2036 閱讀 4313

字串函式

=fields!firstname.value & vbcrlf & fields!lastname.value

=format(parameters!startdate.value, "d") & " through " & format(parameters!enddate.value, "d")

如果文字框僅包含日期或數字,則應使用文字框的format屬性來應用格式設定,而不應在文字框中使用format函式。

=right(parameters!user.value, len(parameters!user.value) - instr(parameters!user.value, "\"))

下面的表示式使用 .net framework system.string 類的成員而不是 visual basic 函式,可得到與上乙個表示式相同的值:

=parameters!user.value.substring(parameters!user.value.indexof("\")+1, parameters!user.value.length-parameters!user.value.indexof("\")-1)

= join(parameters!myselection.value)

=system.text.regularexpressions.regex.replace(fields!phone.value, "(\d)[ -.]*(\d)[ -.]*(\d)", "($1) $2-$3")

注意:

驗證 fields!phone.value 的值沒有多餘的空格並且型別為system.string

轉換函式

使用 visual basic 函式可以將字段從一種資料型別轉換為另一種不同的資料型別。轉換函式可用於將字段的預設資料型別轉換為計算所需的資料型別或用於組合文字。

=cdec(500)

=cstr(parameters!myselection.count)

決策函式

=iif(fields!linetotal.value > 100, true, false)

=iif(fields!pctcomplete.value >= 10, "green", iif(fields!pctcomplete.value >= 1, "blue", "red"))

值大於或等於 10 時,顯示綠色背景;介於 1 和 9 之間時,顯示藍色背景;小於 1 時,顯示紅色背景。

=switch(fields!pctcomplete.value >= 10, "green", fields!pctcomplete.value >= 1, "blue", fields!pctcomplete.value = 1, "yellow", fields!pctcomplete.value <= 0, "red",)

值大於或等於 10 時,顯示綠色背景;介於 1 和 9 之間時,顯示藍色背景;等於 1 時顯示黃色背景;小於或等於 0 時,顯示紅色背景。

=choose(fields!myindex.value,"red","green","yellow")

例如,當 myindex 為 1 時,背景色為「red」。在查詢結果集中,驗證 myindex 的資料沒有超出引數列表的範圍。

=iif(datediff("d",fields!importantdate.value, now())>7,"red","blue")

=iif(fields!phonenumber.value is nothing,"no value",fields!phonenumber.value)

=iif(fields!department.value = "development", "employeereport", nothing)

=iif(isnothing(fields!largephoto.value),true,false)

shell 字串 表示式

在shell程式設計中,經常要處理一些字串變數。比如,計算長度啊 擷取子串啊 字元替換啊等等,常常要用到awk expr sed tr等命令。下面給大家介紹個簡單的字串處理方法,用不著巢狀複雜的子命令。計算value字串的字元數量。或 刪除value字串中以分隔符 匹配的右邊字元,保留左邊字元。或 ...

字串 表示式求值

不曾想到我居然還會寫這種部落格,然而自己是真的對這些模擬很噁心。這簡單,可以遞迴求解,遇到乙個符號,直接往下遞迴。這裡我的處理是有空格的,因此呢可以使用atof將字串轉化了double,atoi好像是轉化為int。include include include include include inc...

棧的應用 計算字串表示式

計算機的本質工作就是做數 算 那計算機可以讀 入字串 1 2 3 4 5 6 7 並計算值嗎?答案是肯定的。這裡我基本實現了個位數的加減乘除,當然這個演算法最簡單的解決方式是採用二叉樹 後面會實現 這裡作出了棧的實現方式。首先引入兩個概念 中綴表示式和字尾表示式 1,在生活中我們通常書寫1 1的時候...