Extend the code context in database queries [SQL] #904
|
Hello, |
Replies: 2 comments
Update:a (temporary) solution has been found using the substring function (variable, start, string length (pos1-pos0)+100) in the select part. If you have another solution, I'd be happy to read it. |
|
Hi, In Reports > Coding Reports you can tick the Text Context box to perform this function. In Project > Settings you can set how many characters before and after.
You should add 1 as sqlite starts the string at the position of 1, and not 0 as python does. ( I added the 1 on separately just for understanding). |
Hi, In Reports > Coding Reports you can tick the Text Context box to perform this function. In Project > Settings you can set how many characters before and after.
In SQL try this, which will show the preceding 100 characters and the postceding 100 characters:
select code_text.cid, substr(source.fulltext, iif(code_text.pos0+1-100 < 1,1,code_text.pos0+1-100), code_text.pos1 - code_text.pos0+1 +200) as "Extended", substr(source.fulltext, code_text.pos0+1, code_text.pos1 - code_text.pos0+1) as "Coded Text" from code_text join source on code_text.fid = source.idYou should add 1 as sqlite starts the string at the position of 1, and not 0 as python does. ( I added the 1 on separately just for…