Forum Discussion
Johnny
New Contributor II
Thank you for the reply, ckattookaran. Your tip for casting the ID as an varchar was helpful. I was getting incompatible field type issues from the case statement when having the ELSE return the ID.
ckattookaran
3 years agoVIP
Here you.
Private Function GetJournals(ByVal si As SessionInfo) As DataTable
Dim dt As New DataTable
Dim sql As New Text.StringBuilder
sql.AppendLine("SELECT CAST(JLT.[ConsId] as varchar) as ConsId")
sql.AppendLine("From [JournalLineItem] As JLT")
sql.AppendLine("WHERE JLT.JournalID = 'ABC'")
Using dbConn As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
dt = BRApi.Database.ExecuteSqlUsingReader(dbConn, sql.ToString, True)
End Using
If dt.rows.Count > 0 Then
dt.Columns("ConsId").MaxLength = -1
dt.Columns("ConsId").ReadOnly = False
For Each dr As DataRow In dt.Rows
dr.BeginEdit
Dim intConsId As Integer = ConvertHelper.ToInt32(dr("ConsId"))
dr("ConsId") = Currency.GetItem(intConsId).Name
dr.EndEdit
Next
End If
Return dt
End Function
Use this in a Dashboard Data Set rule and you can use a data adapter to create the report.
Related Content
- 3 years ago
- 6 months ago
- 2 years ago
- 2 months ago