Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
MarcoARaymundo
Contributor III

Get FieldName in other table Load

Hi!

I have table like this:

BASE:

LOAD

     Id,

     Question1,

     Question2,

     Question3,

     .,

     .,

     .

From [CSVFILES.CSV] ();

The fields Questionx (like this: You have a car?), is a simple anwser (Yes/No)

I must "transform" the fields named "Questionx" to Question and renamed field Questionx  to anwser.

I try someting like this:

1) I Create a map table from Question LOAD * INLINE [QuestionId, Question ....];

2) LET = QuestionId = 0;

FOR EACH vQuestion In $(vQuestions)

  LET = QuestionId = QuestionId + 1;

  LOAD

  RowNo(),

  $(QuestionId)                                                                                                                 as QuestionId,

  FieldValue(FieldName(FieldNumber('$(vQuestion )', 'BASE'), 'BASE'), RowNo())     as Anwser

  RESIDENT BASE

  WHERE FieldName(FieldNumber('$(vQuestion )', 'BASE'), 'BASE') = '$(vQuestion)'

  ;

NEXT

But, The anwser field return null.

can anyone help me?

Tags (1)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Get FieldName in other table Load

If the questions is the field-name then you could transform it with crosstable:

http://community.qlik.com/blogs/qlikviewdesignblog/2014/03/24/crosstable

- Marcus

View solution in original post

5 Replies
MVP & Luminary
MVP & Luminary

Re: Get FieldName in other table Load

You want rename a field then you could use the rename-statement(s) - have a look in help.

- Marcus

MarcoARaymundo
Contributor III

Re: Get FieldName in other table Load

Unfortunately its proposal will not work, I have many question fields to treatment individually.

MVP & Luminary
MVP & Luminary

Re: Get FieldName in other table Load

If I look on your load-statement you might need to load your data with a crosstable-statement to transform your crosstable into a data-stream.

- Marcus

MarcoARaymundo
Contributor III

Re: Get FieldName in other table Load

Marcus this information is related to an investigation of these we respond when we are approached by field researchers. Like this:

QUESTIONSANWSERS
You Have a Car?YES / NO
You Have a Bike?YES / NO
Do you drink a beer?YES / NO
What is your favorite beer?XYZ K2

CSV files bring the same information in the same way, that is, the question is the field name.

What I want is to create a new table with a QuestionID field where I can identify what's the question (1, 2, 3 etc) and this answer.

I have a table where the questions are mapped.

An example of the table is:

LOAD

     Field1,

     Field2,

     Field3,

     Field4,

     QuestionId,

     Anwser

FROM CSVFiles;

MVP & Luminary
MVP & Luminary

Re: Get FieldName in other table Load

If the questions is the field-name then you could transform it with crosstable:

http://community.qlik.com/blogs/qlikviewdesignblog/2014/03/24/crosstable

- Marcus

View solution in original post