Open fatislord opened 1 week ago
Hi. I think there was a problem with cases and case attributes and coded text in the report. The current 3.6 latest code fixes an issue with this (was a problem with survey imported data), but 3.5 and earlier did not. Some solutions here, for text codings only, not images or A/V:
If you go to the Reports > Database queries there is a Coded text with each case SQL query:
Also in this section you can run the following SQL query, to get all codes of cases where the variable is Gender and the value is male. Change Gender and male to whatever values you have in your attributes
-- CODED TEXT WITH EACH CASE BY ATTRIBUTE
select distinct code_name.name as codename, cases.name as casename, code_text.pos0, code_text.pos1, code_text.fid, seltext as "coded text", code_text.owner from code_text join code_name on code_name.cid = code_text.cid join (case_text join cases on cases.caseid = case_text.caseid) on code_text.fid = case_text.fid
join attribute on attribute.id = case_text.caseid
where
attribute.attr_type ="case" and attribute.name = "Gender" and attribute.value = "male"
and
-- code_name.name in ( "Aggression", "Increased workload") and -- provide your code names in quotes
(code_text.pos0 >= case_text.pos0 and code_text.pos1 <= case_text.pos1)
Similarly, uncomment the -- code_name in line, and in here add your exact code names used, to limit to specific codes:
select distinct code_name.name as codename, cases.name as casename, code_text.pos0, code_text.pos1, code_text.fid, seltext as "coded text", code_text.owner from code_text join code_name on code_name.cid = code_text.cid join (case_text join cases on cases.caseid = case_text.caseid) on code_text.fid = case_text.fid
join attribute on attribute.id = case_text.caseid
where
attribute.attr_type ="case" and attribute.name = "Gender" and attribute.value = "male"
and
code_name.name in ( "Aggression", "Increased workload") and
(code_text.pos0 >= case_text.pos0 and code_text.pos1 <= case_text.pos1)
"By the way, It will be nice if you add attributes of file and cases in the exports file as columns. It will be great helpful because sometimes I need to analyze codes of cases with specified attributes. With this feature, I can easily filter the cases using the filter function of excel." Yes OK, is this with the Export Matrix option?
Hi, sorry for the late reply. I have tried your suggestions and it works, but I want to filter the cases with multiple conditions, like, select cases with "Gender" is "male" and "Age" is "below 30". The current solution seems only work with single attribute condition. I'm fresh to the SQL and have tried several way by web searching, but none of the web answers works.
Forget to append the setting: my QualCoder version is v3.5, os is windows, and the issue of attribute selection happened when I processed the the survey-imported data, which is aligned with your analysis.
"Yes OK, is this with the Export Matrix option?", I think adding attributes of case as columns in default export table is OK to me, as I can use the attributes as filters to operate the datasheet. But I think it will be useful in the matrix format, too.
@fatislord hi, here is an update for 2 attributes, you can extend with 3, 4, or more, by following the example. Note I commented out the code names filter, but you can uncomment (by removing the --) and add a code names filter. Note All variable values are stored as strings of text. So number values need to be cast as integer, or cast as real (for floating point numbers).
select distinct code_name.name as codename, cases.name as casename, code_text.pos0, code_text.pos1,
code_text.fid, seltext as "coded text", code_text.owner
from code_text join code_name on code_name.cid = code_text.cid
join (case_text join cases on cases.caseid = case_text.caseid) on code_text.fid = case_text.fid
join attribute on attribute.id = case_text.caseid
join attribute as attribute2 on attribute2.id = case_text.caseid
where
attribute.attr_type ="case" and attribute.name = "Gender" and attribute.value = "male" and
attribute2.attr_type ="case" and attribute2.name = "Age" and cast(attribute2.value as integer) < 30 and
-- code_name.name in ( "Aggression", "Increased workload") and
(code_text.pos0 >= case_text.pos0 and code_text.pos1 <= case_text.pos1)
It works!! Thank you very much :)
Glad to help
Hello, thank you very much for this outstanding project, it helps a lot!
I'm frustrated when I use the 'Attribute Selection Parameters' feature in the reports window. I want to export the codes of specified cases, and it could be possible, in my understanding, by filtered the cases using the attribute selection parameter feature. However, I found the outputs are still a set of all codes when I added some restrictions in the attribute selection window, and these restrictions seems not affect the output results. I'm wondering if I misunderstand about this feature, or some wrongs with my usage? I have read the relative part in user manual and watched the tutorial video, but they didn't solve my question unfortunately.
Could you please clarify the usage of this feature more clearly? and if I could use this feature to achieve my goal?
By the way, It will be nice if you add attributes of file and cases in the exports file as columns. It will be great helpful because sometimes I need to analyze codes of cases with specified attributes. With this feature, I can easily filter the cases using the filter function of excel.
Thank you!