Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Alias Dinamico / Dynamic Alias

Pessoal, estou com um problema para gerar um alias dinamico, por exemplo, eu tenho uma tabela com id, campo e valor; (campo é o nome do campo relacionado ao valor e valor o valor deste campo), tentei fazer o seguinte:

extras:

LOAD id,

          valor as campo;

SQL ........... Sendo que este SQL me retorna esta estrutura de id, campo e valor.

Porém , ao fazer este script acima é como se ele ignorasse a linha "valor as campo", pois não faz nada, quando olho as estruturas das tabelas, a tabela extra só possui o campo id.

Alguem consegue me ajudar? Abraços

Hello, i'm with a problem to create an dynamic alias, for example: i have a table with the fields id, field, value; (field contains the name of the fields related to values, and value is the value of the field ), i tried to do the following:

extras:

LOAD id,

  value as field;

SQL ........... SQL returns this structure of id, field, value.

But, when i execute this script it ignores the line "value as field", because nothing happens, and when i see the tables structures, the table 'extra' only has the id field.

15 Replies
Not applicable
Author

Do you have an example using 'for'? I tryed it, but didn't work too =/.

danielrozental
Master II
Master II

Have you tried using crosstables?

Not applicable
Author

If you change your alias (as campo_teste) to any other one, does the field is returned?

Not applicable
Author

No, the first word before 'as' returns the value of the field, but after 'as' the word becomes an String, to resolve this i changed it to "value as [$(=field)]", because if i use expression it works, but the result of expression is 'internal error', i think when i use an expression, it brings all the contents of theis field, not the only one that i need.

danielrozental
Master II
Master II

Guilherme, build a sample QVW with what you're trying to achieve so we can help you.

Not applicable
Author

Ok, i can't post it now, because i need to do some things here, but i will post it.