I am using a calendar control (not component) to display events from a database as described in the alpha documentation quoted and linked below:
Looks great with my app but I can't figure out the last step. It is a multi-tenant app and I need to filter the events by the logged in user.
The section of the xbasic code that creates the Json data for the calendar is below. I have tried adding the following below the select statement:
WHERE username= session.username
WHERE username = Context.Security.CurrentUser
WHERE username = :username (tried several ways to pass in this argument).
Hard coded as WHERE username ="paul" does work.
Any ideas on how to filter the SQL data in this context?
From the Alpha documentation:
dim jsonData as c
dim def as p
dim defn as p
defn.type = "sql"
defn.connectionString = "::Name::AADemo-Northwind"
defn.tableName = <<%sql%
SELECT Orders.OrderID as OrderId,
concatenate(orders.orderid,': ', customers.companyname) as eventName,
Orders.OrderDate as orderDate,
concatenate('Order: ', orders.orderid, ': ', customers.contactname, ' ', customers.companyname) AS eventdescription
FROM Orders Orders
INNER JOIN Customers Customers
ON Orders.CustomerID = Customers.CustomerID
%sql%
defn.startDate = year(startDate) + "-" + month(startDate) + "-" + day(startDate)
defn.endDate = year(endDate) + "-" + month(endDate) + "-" + day(endDate)
defn.eventDate = "orderDate"
defn.eventId = "orderId"
defn.eventName = "eventName"
defn.eventDescription = "eventdescription"
jsonData = a5_GetCalendarEventDataJSON(defn)
From:
https://www.alphasoftware.com/docume...%20Definitions
Looks great with my app but I can't figure out the last step. It is a multi-tenant app and I need to filter the events by the logged in user.
The section of the xbasic code that creates the Json data for the calendar is below. I have tried adding the following below the select statement:
WHERE username= session.username
WHERE username = Context.Security.CurrentUser
WHERE username = :username (tried several ways to pass in this argument).
Hard coded as WHERE username ="paul" does work.
Any ideas on how to filter the SQL data in this context?
From the Alpha documentation:
dim jsonData as c
dim def as p
dim defn as p
defn.type = "sql"
defn.connectionString = "::Name::AADemo-Northwind"
defn.tableName = <<%sql%
SELECT Orders.OrderID as OrderId,
concatenate(orders.orderid,': ', customers.companyname) as eventName,
Orders.OrderDate as orderDate,
concatenate('Order: ', orders.orderid, ': ', customers.contactname, ' ', customers.companyname) AS eventdescription
FROM Orders Orders
INNER JOIN Customers Customers
ON Orders.CustomerID = Customers.CustomerID
%sql%
defn.startDate = year(startDate) + "-" + month(startDate) + "-" + day(startDate)
defn.endDate = year(endDate) + "-" + month(endDate) + "-" + day(endDate)
defn.eventDate = "orderDate"
defn.eventId = "orderId"
defn.eventName = "eventName"
defn.eventDescription = "eventdescription"
jsonData = a5_GetCalendarEventDataJSON(defn)
From:
https://www.alphasoftware.com/docume...%20Definitions
Comment