Forum Discussion
Krishna
Valued Contributor
The below is the code to join application and Framework Tables.
Select Case args.FunctionType
Case Is = DashboardDataSetFunctionType.GetDataSetNames
Dim names As New List(Of String)()
names.Add("MyDataSet")
Return names
Case Is = DashboardDataSetFunctionType.GetDataSet
If args.DataSetName.XFEqualsIgnoreCase("MyDataSet") Then
'Create a Join DT Table
Dim DT_FInal As New DataTable()
'
DT_FInal.Columns.Add("Name")
DT_FInal.Columns.Add("JStatus")
'FrameWork DB
Dim SQL As New Text.StringBuilder()
SQL.AppendLine("Select UniqueID, Name from SecUser")
Dim Fdt As New DataTable
Using DbConnApp As DbConnInfo = BRApi.Database.CreateFrameworkDbConnInfo(si)
Fdt = BRApi.Database.ExecuteSql(DbconnApp, sql.ToString, False)
'Application DB
Dim ASQL As New Text.StringBuilder()
ASQL.AppendLine("Select Case When JournalStatus = 4 Then 'Posted' Else 'Unposted' End AS JStatus,
PostedUserID From JournalHeader")
Dim Adt As New DataTable
Using ADbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
Adt = BRApi.Database.ExecuteSql(ADbConnApp, ASQL.ToString, False)
'LinQ Query
Dim aa
Dim Query = From fuser In Fdt.AsEnumerable _
Join auser In Adt.AsEnumerable _
On fuser.Field(Of system.Guid)("UniqueID") Equals auser.Field(Of system.Guid)("PostedUserID") _
Select New With {Key .Name = fuser.Field(Of String)("Name"), _
Key .JStatus = auser.Field(Of String)("JStatus")}
For Each aa In Query
DT_FInal.rows.Add(aa.Name, aa.JStatus)
Next
Return DT_FInal
End Using
End Using
End If
End Select
adykes
3 years agoNew Contributor III
Hi Krishna, thanks for your response, it is very helpful. I am new to Dashboard Data Set BRs and am wondering how would you go about calling this function in a Data Adapter? Thanks
- Krishna3 years agoValued Contributor
Hi Adykes - here we go
{BRName}{Datasetname}{Name1=Value1, Name2=[Value2]} and if you do not have any parameter make it as {}
Hope this helps.