Dynamic list & table alias

Posts   
 
    
RK
User
Posts: 3
Joined: 25-Nov-2005
# Posted on: 30-Nov-2005 14:09:52   

(Using v 1.0.2005.1 Final, Sql server 2000 and adapter)

Bug:

When producing a dynamic list with a between clause this is the sql created... SELECT xxx FROM [ccc6_skv].[dbo].[shifts] AS [Shift]
WHERE ( [ccc6_skv].[dbo].[shifts].[shift_id] BETWEEN 1 AND 2)

The SQL Server raises an error. The t-sql should use the alias in the where cluase, something like this... SELECT xxx FROM [ccc6_skv].[dbo].[shifts] AS [Shift]
WHERE ( [shift].[shift_id] BETWEEN 1 AND 2)

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 30-Nov-2005 14:36:22   

Could you please tell us what runtime libraries version you are using.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 30-Nov-2005 14:40:41   

What's the code you've used for the dynamic list and the call ? Because you have to specify the ObjectAlias in the FieldBetweenPredicate if you alias the entity in the relations.

(edit): Either set the field's ObjectAlias to the alias of the entity or the predicate's ObjectAlias to the alias of the entity. But without code it's guesswork wink

Frans Bouma | Lead developer LLBLGen Pro
RK
User
Posts: 3
Joined: 25-Nov-2005
# Posted on: 01-Dec-2005 09:26:31   

Otis wrote:

What's the code you've used for the dynamic list and the call ? Because you have to specify the ObjectAlias in the FieldBetweenPredicate if you alias the entity in the relations.

(edit): Either set the field's ObjectAlias to the alias of the entity or the predicate's ObjectAlias to the alias of the entity. But without code it's guesswork wink

Yes. Sorry. I assumed the defineField sub internally would fix it, but obviously I was wrong.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 01-Dec-2005 09:36:51   

RK wrote:

Otis wrote:

What's the code you've used for the dynamic list and the call ? Because you have to specify the ObjectAlias in the FieldBetweenPredicate if you alias the entity in the relations.

(edit): Either set the field's ObjectAlias to the alias of the entity or the predicate's ObjectAlias to the alias of the entity. But without code it's guesswork wink

Yes. Sorry. I assumed the defineField sub internally would fix it, but obviously I was wrong.

Yes, because there you define the entity alias you specify for entities in the relations (if any) passed to the fetch method. Normally, you don't need to alias entities and therefore don't need to specify an alias for the entity in the DefineField simple_smile . Only alias entities if you specify multiple times the same entity in the relations.

Frans Bouma | Lead developer LLBLGen Pro