SQL Query Error - column count doesn't match output structure attribute count

SQL Query Error - column count doesn't match output structure attribute count

  

Hi,

I'm new to Outsystems and I'm trying to do a basic sql select from an entity I've setup.

SELECT {Tickets}.[Id] FROM {Tickets}

I've added the Tickets entity as my output structure.

When I click Test I get "column count doesn't match output structure attribute count", see attachment.

If I run SELECT {Tickets}.* FROM {Tickets} it works fine and pulls in all the attributes.

Am I missing something ?

Thanks

Solution

Hello

What I guess you are doing wrong its really what the error is saying.

If you check your query you are selecting one atribute which is the Tickets.ID and in the output you have an entity which has more attributes ( I assume ) beside the ID.

What you have to do so you dont have the yellow warning is one of the following:

Save the output to a variable of type Tickets Identifier

or

Select all the atributes to save them to the entity doing Select * FROM Tickets 


If you need help tell us


Cheers,

VC


Solution

Hi, what vincent said :)


furthermore, since you are new to Outsystems, I strongly suggest to use aggregates.

they are really handy and optimized!


Vincent Colpa wrote:

Hello

What I guess you are doing wrong its really what the error is saying.

If you check your query you are selecting one atribute which is the Tickets.ID and in the output you have an entity which has more attributes ( I assume ) beside the ID.

What you have to do so you dont have the yellow warning is one of the following:

Save the output to a variable of type Tickets Identifier

or

Select all the atributes to save them to the entity doing Select * FROM Tickets 


If you need help tell us


Cheers,

VC

Thanks 



Hi Mark, 

As Vincent said, you have 2 options to solve this,

1) take all record from entity i. e. 

SELECT {Tickets}.* FROM {Tickets}

2) Create one structure and add attribute of type Ticket Identifier and use that structure as output structure