Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am hoping anyone has an idea of debugging and troubleshooting this scenario. I created a Generic table as my data came in an unformatted list table format. I was able to create a consolidated Generic table with all of my fields, but now need to slice and dice further. I thought of now creating a CrossTable with specific fields I need to perform a count on. In my Script I receive a message "Generic Fields not Found." The issue is it doesn't point to any particular break point in my code. Is it valid to process a Generic Table, and then process a Cross Tab on that data?
If not, are there any ways within Qlik to simply perform operations on the resulting matrix from the Generic table? I am stuck here and would appreciate any help.
thanks,
Chris
Hi All,
Happy to report that this data transformation is working as conceived now. Rob, thank you so much for the help.
For this example, it should be 10 fields in my above example. Simply put I have a lot of fields and miscounted by 1 and my load failed so that is an important lesson. thanks for checking my code !
Chris
The Generic Load prefix will produce several tables (one for each attribute name), so subsequent processing with CrossTab would be difficult as the CrossTab can only read one table at a time. A workaround is to join the separate tables into one and then process. That seems to be overly complicated.
Can you provide some sample data that shows what you are trying to accomplish and perhaps we can come up with some suggestions?
-Rob
Hi Rob,
I really appreciate the feedback here!! I provided some example code of what I am doing below which I have simplified for this purpose. For reference I am creating one consolidated table from the resulting tables in the Generic Load, and now want to perform a CrossTab on that resulting table (Seems possible although could use guidance). The reason for doing this may be hard to explain, but simply stated the original format of this survey is very sloppy, and there is data we need to ignore for our actual analysis. Joining the Generic Load tables helps, but still leaves difficulty in creating formulas on that data because it is one gigantic matrix. Performing a CrossTab to create just two columns would make analysis a lot easier in my opinion. (Also, I am a Qlik newbie so I may be missing something here)
//Initial Data Load
[Survey_Answers]:
LOAD surveyid,
suvey_sectionid,
survey_sectionname,
survey_category
survey_questionid,
survey_questionname,
survey_answervalue,
date;
SQL SELECT *,FROM <ExternalDataSource>;
//Generic Load (Creates a table for each Survey Question with the answers as a value in that field
[Generic_Load_Survey_Answers]:
Generic LOAD
surveyid,
survey_questionname,
survey_answervalue
Resident [Survey_Answers];
//This code joins all of those disparate tables into one consolidated table which makes most calculations easier
[Generic_Survey_Answers_Join]:
LOAD Distinct surveyid Resident [Survey_Answers];For i=NoOfTables()-1 to 0 STEP -1;
Let vTable = TableName($(i));
IF WildMatch('$(vTable)','Generic_Load_Survey_Answers.*') THEN
LEFT JOIN ([Generic_Survey_Answers_Join]) LOAD * RESIDENT [$(vTable)];
Drop Table [$(vTable)];
ENDIF
Next i
//This is the code that is not working for me. I would like to now unpivot specific columns as there are many fields (survey_questionname) in the above table we don't need. I hope to produce two columns from this CrossTable Load. One that only Includes questions we care about and answers we care about. These 10 questions below are not needed, and I want to remove from my "analysis" columns
[Survey_CrossTable_Answers]:
CrossTable(Survey_Questions_UnPivot,Survey_Answers_UnPivot,10)LOAD
surveyid,
question1 as question1_CrossTab,
question2 as question2_CrossTab,
question3 as question3_CrossTab,
question4 as question4_CrossTab,
question5 as question5_CrossTab,
question6 as question6_CrossTab,
question7 as question7_CrossTab,
question8 as question8_CrossTab,
question9 as question9_CrossTab,
question10 as question10_CrossTab,
Resident [Generic_Survey_Answers_Join];
*The error I get is "Generic Fields are not found", but I have cross-referenced my[Generic_Survey_Answers_Join] table and I see them in there
I wish to run Qliksense web app with Python script and automate the reporting process. Moreover i need to perform a bunch of operations on Excel sheets before exporting, for which I need to use VBA. I've tried using few libraries from GitHub but none of them seem to work with python.
Your issue is the third parameter to CrossTable. You have "10", it should be "1". This parm represents the number of fields that should be loaded as normal, not un-pivoted. In your case only the field "surveyid".
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Hi Rob,
Thanks for the quick follow up. I actually want those first 10 fields to be loaded as Normal and not un-pivoted. The reason being is I want to ignore all of those columns from my unpivoted field. Is that possible? I have done something similar in another application.
Thanks,
Chris
Seeing as you have 11 fields in the Load, it should work, but I don't know why it doesn't. Just as a test can you change the 10 to 9?
-Rob
Hi All,
Happy to report that this data transformation is working as conceived now. Rob, thank you so much for the help.
For this example, it should be 10 fields in my above example. Simply put I have a lot of fields and miscounted by 1 and my load failed so that is an important lesson. thanks for checking my code !
Chris