DBNull Parser for VBScript

Function ParseDBNull(objVal,strDataType)

         If ISNull(objVal) = True Then

               Select Case  lcase(strDataType)

                           Case “string”,”datetime”

                                       ParseDBNull = “”

                          Case “numeric”

                                    ParseDBNull = 0

                         Case “boolean”

                                    ParseDBNull = False

                         Case Else

                                     ParseDBNull = “”

                    End Select

             Else

                      ParseDBNull = objVal

              End If

End Function

Adding PopUpMenu Items dynamically to the DataGrid’s PopUpMenu in SalesLogix6.2

Hi All,

You can use the following method to add menu items dynamically to the PopUpMenu of the DataGrid control of the SalesLogix6.2 LAN Client.

Sub PupulateMenu()

dim objMnu,i
dim arrMenuItems

 arrMenuItems = Array(“Menu Item1″,”Menu Item2″,”Menu Item3″,”Menu Item4”)
 set objMnu = <DataGrid Control Name>.PopupMenu

 For i=0 to Ubound(arrMenuItems)
 objMnu.Add
 objMnu.Items(i+1).Caption = arrMenuItems(i)
 Next

End Sub

Sub <DataGrid Control Name>MenuClick(Sender,Item) 

Select case  <DataGrid Control Name>.PopupMenu.MenuIndex
        case 1
             msgbox “Menu Item1 Selected”
        case 2
             msgbox “Menu Item2 Selected”
        case 3
             msgbox “Menu Item3 Selected”
        case 4
             msgbox “Menu Item4 Selected”
        case else
             msgbox “Invalid Menu Option”
 End Select

End Sub

Happy Coding!! 🙂

How to compare time values in SQL Server 2005

The following query filters the results set based on the time value only

Select * From <Table Name>

Where  Convert(Varchar(8),<DateTime Field Name>,8) >= ‘<Time Value>’

In the above query it will compare a time value with the format of,

           hh:mm:ss

If you don’t want the seconds portion of it simply reduce the length of the converted field

ie. Convert(varchar(5),<DateTime Field Name>,8)      this will only return a time value with the format of,

        hh:mm

Happy coding!!