有内联加载我必须将歌曲ID添加到豁免列表中:
Exemptsongs:
Load * Inline [
Song ID
45875
65463
43785
90347
23456
89438
16745
];
Exemptsongsmap:
Mapping LOAD
[Song ID],'Exempt' as [Exempt songs exempt]
Resident Exemptsongs;
DROP Table Exemptsongs;
然后在需要时将其加载到播放列表表格的其他位置。
我想要做的还是添加由特定用户添加的歌曲ID以免除,但只有当该用户添加时,他们才会被其他人添加时免除(除非特别在豁免列表中)上文)。
我在想(伪)这样的东西:
Exemptsongs:
Load * Inline [
Song ID
45875
65463
43785
90347
23456
89438
16745
(SELECT SongID FROM Songs WHERE addedbyuser = 'MATT')
];
Exemptsongsmap:
Mapping LOAD
[Song ID],'Exempt' as [Exempt songs exempt]
Resident Exemptsongs;
DROP Table Exemptsongs;
然后在加载播放列表时,applymap部分当前为:
ApplyMap('Exemptsongsmap',[Playlist ID],'Non-exempt') as [Exempt songs exempt],
但是如果被其他人添加的话,就不能想到如何不允许使用该歌曲。
e.g。
如果用户matt添加了歌曲ID 12345并且另一个用户添加了它,我希望它在播放列表中被免费播放时可以免除。
错误1:
Syntax error, missing/misplaced FROM:
Exemptsongs:
Load [Song ID]& as UniqueID Inline [
Song ID
45875
65463
43785
90347
23456
89438
16745
]
Exemptsongs:
Load [Song ID]& as UniqueID Inline [
Song ID
45875
65463
43785
90347
23456
89438
16745
]
错误2:
Field not found - <Song ID>
load [Song ID]&addedbyuser as UniqueID
from Songs
where addedbyuser='Matt';
错误3:
Table not found
Exemptsongsmap:
Mapping LOAD Distinct
UniqueID,'Exempt' as [Exempt songs exempt]
Resident Exemptsongs
错误4:
Table not found
DROP TABLES statement
然后我们还没有改变其他多个错误......
答案 0 :(得分:1)
您需要创建一个唯一的ID,即SongId和addedbyuser连接。 chr(39)的东西只是创建一个列表,每个值都为'value'。
USERS:
load concat(distinct addedbyuser,chr(39)&','&chr(39)) as userids from Songs;
let vList = chr(39)&fieldvalue('userids',1)&chr(39);;
for each a in $(vList)
ExemptSongs:
Load [Song ID]&$(a) as UniqueID;
Inline [
Song ID
45875
65463
43785
90347
23456
89438
16745
];
next a
//Allow auto concatenate of these tables
load [Song ID]&addedbyuser as UniqueID
from Songs
where addedbyuser='Matt';
Exemptsongsmap:
Mapping LOAD distinct
UniqueID,'Exempt' as [Exempt songs exempt]
Resident Exemptsongs;
DROP Table Exemptsongs;
然后最后
ApplyMap('Exemptsongsmap',[Playlist ID]&addedbyuser,'Non-exempt') as [Exempt songs exempt],