Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Denne artikel hjælper dig med at forespørge Microsoft Learn Organisationsrapporteringstjeneste, når du synkroniserer med en Azure SQL-database. Hvis du ikke kender detaljerne i Learn Organisationsrapportering-tjenesten eller use cases til den, anbefaler vi, at du gennemser artiklen oversigt over funktion først.
Få status for brugeren via Microsoft Entra-objekt-id
Kolonnen userId refererer til bruger-id'et for Learn-profilen og ikke Microsoft Entra-objekt-id'et. Hvis du vil hente status for en bestemt bruger ved hjælp af et Microsoft Entra-objekt-id, skal du joinforbinde brugerne og statustabellerne.
DECLARE @aadObjectId VARCHAR(50)
SELECT users.AADObjectId, progress.*
FROM users_TENANT_ID_HERE users
JOIN progress_TENANT_ID_HERE progress ON users.userId = progress.userId
WHERE users.AADObjectId = @aadObjectId
Få status med procent fuldført for et bestemt Learn-oplæringselement
Procentfuldførelse kan beregnes på baggrund af durationInMinutes, som kan beregnes under hentning af statusdata for bestemte Microsoft Learn-træningselementer.
DECLARE @sourceType NVARCHAR(50)
DECLARE @sourceUid NVARCHAR(300)
-- If querying for a specific user:
-- DECLARE @aadObjectId VARCHAR(50)
SELECT
users.AADObjectId,
@sourceUid AS SourceUid,
@sourceType AS SourceType,
progress.XPReason,
progress.XP,
progress.AwardedOn,
CASE
WHEN progress.AwardedOn IS NOT NULL THEN
(
SELECT 1
)
WHEN @sourceType = 'LearningPath' THEN
(
-- User completed minutes of learning path
SELECT SUM(m.durationInMinutes)
FROM HierarchyLearningPathModule lpm
JOIN HierarchyModule m ON m.moduleUid = lpm.ModuleUid
JOIN progress_TENANT_ID_HERE p ON p.SourceUid = lpm.ModuleUid
WHERE lpm.LearningPathUid = @sourceUid
AND p.userId = users.userId
AND p.SourceType = 'Module'
AND p.XPReason = 'points.module.basic.completed'
) / CAST(
(
-- Total duration of learning path
SELECT lp.durationInMinutes
FROM HierarchyLearningPath lp
WHERE lp.LearningPathUid = @sourceUid
) AS DECIMAL(5, 2))
WHEN @sourceType = 'Module' THEN
(
-- User completed minutes of module
SELECT SUM(unit.durationInMinutes)
FROM progress_TENANT_ID_HERE p
JOIN HierarchyUnit unit ON unit.unitUid = p.SourceUid
AND unit.moduleUid = @sourceUid
AND p.userId = users.userId
AND p.SourceType = 'Unit'
AND p.XPReason = 'points.unit.basic.completed'
) / CAST(
(
-- Total duration of module
SELECT m.durationInMinutes
FROM HierarchyModule m
WHERE m.moduleUid = @sourceUid
) AS DECIMAL(5, 2))
END AS PercentComplete
FROM users_TENANT_ID_HERE users
LEFT JOIN progress_TENANT_ID_HERE progress
ON users.userId = progress.userId
AND progress.SourceType = @sourceType
AND progress.SourceUid = @sourceUid
-- If querying for a specific user:
-- WHERE users.AADObjectId = @aadObjectId