Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

xiyuzw1113
New Contributor III

Load table with condition

Hi all, I now have a problem about loading table from existing table with condition.

I have connected Survey Monkey and want to select some fields from the table. For example I would like to chose records which field 'question' includes key words like " postive impacts" or " business outcomes". But I can load the table with condition so I load the whole table first.

The script I wrote for load the table is:

[Mid_Program Participant template]:

LOAD

   respondent_id as [GetResponses.respondent_id],

   answer as [GetResponses.answer],

     question as [GetResponses.question];

SELECT respondent_id,

       question,

       answer

FROM GetResponses

WITH PROPERTIES (

  surveyId= '128081116'

);

Then I worte another script to load these fields to another table and added some new fields,

[Mid_Program Participant]:
When wildmmatch( quesion,'postive impacts') + wildmmatch( quesion,'business outcomes')

LOAD

   [GetResponses.respondent_id],
   [GetResponses.question],
   [GetResponses.question],
    'CLientA' as Mid_ProClient,

     'Leadership' as Online_event,

    'LocationA' as Online_occurance
Resident [Mid_Program Participant template1];

Drop table [Mid_Program Participant template1];

Unfortunatly these scripts did't work, any suggestion?

Tags (1)
9 Replies
thiago_justen
Valued Contributor III

Re: Load table with condition

Maybe this will help you:

[Mid_Program Participant]

LOAD

  [GetResponses.respondent_id],
  If (WildMatch ('[GetResponses.question]', '*positive impacts*,'*business outcomes*')>0,[GetResponses.question]) as question,

  [GetResponses.question],
    'CLientA' as Mid_ProClient,

    'Leadership' as Online_event,

    'LocationA' as Online_occurance
Resident [Mid_Program Participant template1];

Drop table [Mid_Program Participant template1];

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
xiyuzw1113
New Contributor III

Re: Load table with condition

Hi Thiago, I have tried something below and it worked

[Mid_Program Participant template]:

LOAD

   respondent_id as [GetResponses.respondent_id],

   answer as [GetResponses.answer],

     question as [GetResponses.question];

SELECT respondent_id,

       question,

       answer

FROM GetResponses

WITH PROPERTIES (

  surveyId= '128081116'

);

[Mid_Program Participant]:

LOAD

   [GetResponses.respondent_id] as Mid_PP_ID,

    'CLientA' as Mid_PClient,

    'Leadership' as Mid_PEvent,

    'LocationA' as Mid_POccurance,

   [GetResponses.question] as Mid_PP_Question, 

   [GetResponses.answer] as Mid_PP_Answer

Resident [Mid_Program Participant template]

   Where WildMatch([GetResponses.question],'*Changes at work*') or  WildMatch([GetResponses.question],'*outcome*');

But now I would like to load some data to  [Mid_Program Participant] from another table with the same way, and I use :

[Mid_Program Participant template]:

LOAD

   respondent_id as [GetResponses.respondent_id],

   answer as [GetResponses.answer],

     question as [GetResponses.question];

SELECT respondent_id,

       question,

       answer

FROM GetResponses

WITH PROPERTIES (

  surveyId= '128084936'

);

LOAD

   [GetResponses.respondent_id] as Mid_PP_ID,

    'CLientB' as Mid_PClient,

    'Teamwork' as Mid_PEvent,

    'LocationB' as Mid_POccurance,

    [GetResponses.question] as Mid_PP_Question, 

   [GetResponses.answer] as Mid_PP_Answer

Resident [Mid_Program Participant template]

// filter the rows we need

   Where WildMatch([GetResponses.question],'*Changes at work*') or  WildMatch([GetResponses.question],'*outcome*');

Drop table [Mid_Program Participant template];

There are some mistakes about this part, not sure which part is wrong. Any suggestions?

thiago_justen
Valued Contributor III

Re: Load table with condition

Hey there,

Check this out:

// filter the rows we need

  Where [GetResponses.question]=WildMatch([GetResponses.question],'*Changes at *') or [GetResponses.question]=WildMatch([GetResponses.question],'*outcome*');

Drop table [Mid_Program Participant template];

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
thiago_justen
Valued Contributor III

Re: Load table with condition

Rachel,

Any news about your question? Did you solve the problem?

Cheers

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
xiyuzw1113
New Contributor III

Re: Load table with condition

Thiago, thanks for your suggestion. Yes this problem was solved while I am stuck by another problem.

thiago_justen
Valued Contributor III

Re: Load table with condition

So, please close this thread by marking the response that helped you.

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
xiyuzw1113
New Contributor III

Re: Load table with condition

Tks!

pablolabbe
Valued Contributor II

Re: Load table with condition

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others

xiyuzw1113
New Contributor III

Re: Load table with condition

Thanks for reminding me. I have marked 'helpful' and  ' Assumed Answered'. If there was any other steps please tell me, coz I am new to here and still learning to use some functions.