20101022
การดึงค่าจากตารางมาสู่ตัวแปรของภาษาเบสิคใน Libre/Open Office มีแค่สองอย่างคือ Value ที่เป็นตัวเลขกับ String ที่เป็นตัวอักษร บางทีได้ค่ามาเป็นตัวอักษรต้องการแปลงเป็นตัวเลขทำได้ง่ายๆ ดังนี้
A = “123.456″
myValue = Val(A)
เมื่อได้ค่ามาเป็นตัวเลขแล้วจะทำการเปลี่ยนเป็นชนิดตัวเลขเป็นอย่างอื่นภายหลังได้
หรือสามารถใช้ฟังก์ชั่นในการเปลี่ยนได้เลยจากค่าในตารางได้ดังนี้
CStr(Var)
converts any data type into a string.
CInt(Var)
converts any data types into an integer value.
CLng(Var)
converts any data types into a long value.
CSng(Var)
converts any data types into a single value.
CDbl(Var)
converts any data types into a double value.
CBool(Var)
converts any data types into a Boolean value.
CDate(Var)
converts any data types into a date value.
อ้างอิง http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/Conversion_Functions_(Runtime_Library)