I have a MASK content element where the editor can choose some records to put out as teasers (see screenshot below). The content should be output in the order selected by the editor. The UID List for example will look like this: 19,18,20,17
In the MySQL syntax the function SELECT FIND_IN_SET() does this job, I think - how can I use it (or a similar functionality) in the select part of a typoscript CONTENT object?
Thank you in advance for any help.
EDIT: My code example - neither the orderBy clause work nor the where clause:
table = tt_content
select {
pidInList = 11,12
uidInList.data = field:recid // the list with the wanted record IDs (19,18,20,17) transferred from the content object
recursive = 2
join = sys_category_record_mm ON sys_category_record_mm.uid_foreign = tt_content.uid
orderBy.data = field:recid
orderBy.wrap = FIND_IN_SET(`tt_content`.`uid`,'|')
where = tt_content.CType='mask_cnt_textpic_uni'
#where.data = field:recid
#where.wrap = FIND_IN_SET(`tt_content`.`uid`,'|')
where.data = field:syscats
where.intval = 1
where.wrap = sys_category_record_mm.uid_local IN (|)
max = 999
}
Thanks to the note from HerrZ I found the solution - here my customized script:
10 = CONTENT
10 {
table = tt_content
select {
pidInList = 11,12
uidInList.data = field:recid
recursive = 2
selectFields.dataWrap = *,FIND_IN_SET(`uid`,'{field:recid}') AS reclist_sortby
join = sys_category_record_mm ON sys_category_record_mm.uid_foreign = tt_content.uid
where = tt_content.CType='mask_cnt_textpic_uni'
where.data = field:syscats
where.intval = 1
where.wrap = sys_category_record_mm.uid_local IN (|)
orderBy = reclist_sortby
}
renderObj = COA
renderObj { ... }
}
Important note: In the FIND_IN_SET syntax, the parameters must be quoted as shown in the example - otherwise Typo3 will throw an error ("Incorrect parameter count in the call to native function 'FIND_IN_SET'").