Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Use of ListBox with a lookupcall
Use of ListBox with a lookupcall [message #1078082] Fri, 02 August 2013 14:15 Go to next message
Ranto ANDRIANJAFY is currently offline Ranto ANDRIANJAFY
Messages: 7
Registered: July 2013
Junior Member
Hi,

I use ListBox which is populate with a Lookupcall and I want to know how is the SQL script to use with it.
SELECT    P.IDPROD,
          P.NOMPROD
FROM      PROD P
WHERE     1 = 1
          AND (P.CAT_IDCAT = :master
          OR
          :master IS NULL)


I get the error:
java.sql.SQLException: Operand should contain 1 column(s)]]

[Updated on: Fri, 02 August 2013 14:21]

Report message to a moderator

Re: Use of ListBox with a lookupcall [message #1078184 is a reply to message #1078082] Fri, 02 August 2013 16:41 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 765
Registered: October 2011
Senior Member
Without the context, it is difficult to answer. Your code seems correct. Let guess:

What is the type of your LookupCall#getMaster()? Are you sure you do not have a list or an array in this?

Have you access to the plain sql logs?

I have tried to google "Operand should contain 1 column(s)" there is a lot of topics with MySql. Are you using this engine?

Have you tried with just "AND P.CAT_IDCAT = :master" or just "AND :master IS NULL" to determine where the problem is located.
Re: Use of ListBox with a lookupcall [message #1078214 is a reply to message #1078184] Fri, 02 August 2013 17:36 Go to previous messageGo to next message
Ranto ANDRIANJAFY is currently offline Ranto ANDRIANJAFY
Messages: 7
Registered: July 2013
Junior Member
The type of LookupCall#getMaster() is Long[]. Yes I use MySQL. It is ok when I select one item, but when I make another selection, error!! My question is:
Is there any function to get the master value (like getMaster()) in a LookupService (server side)? If this function exists I can build the SQL script correctly.
Thanks.
Re: Use of ListBox with a lookupcall [message #1079843 is a reply to message #1078214] Mon, 05 August 2013 06:34 Go to previous message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 765
Registered: October 2011
Senior Member
Hi,

I think you are exactly in this case: Operand should contain 1 column(s)

Quote:
I think, the problem is the "WHEN (${CampType}) IS NOT NULL"
For this case, the value should not be a list.

Instead of "${CampType}" eclipse scout uses a syntax like this ":campType", but this is the same.

I do not know MySQL very well. I cannot tell what your solution could be.


Ranto ANDRIANJAFY wrote on Fri, 02 August 2013 19:36
My question is:
Is there any function to get the master value (like getMaster()) in a LookupService (server side)?


I am not sure what you want to do. Please notice that for your lookup service, you can extend AbstractSqlLookupService or AbstractLookupService.

1/
Extending AbstractLookupService is more generic. You implement:
* LookupRow[] getDataByKey(LookupCall call)
* LookupRow[] getDataByText(LookupCall call)
* LookupRow[] getDataByAll(LookupCall call)
* LookupRow[] getDataByRec(LookupCall call)

In this case you have access to call.getMaster().


2/
If you extend AbstractSqlLookupService, you get implementations for the four methods that are based on the SQL statement provided by getConfiguredSqlSelect(). The call object is provided as SQL bind. This means that you are limited to what you can do in the SQL statement.



If you need a more complex logic, you might need to use AbstractLookupService instaead of AbstractSqlLookupService. This way you can build the SQL script with more flexibility.


Previous Topic:Desktop aplication and web aplication.
Next Topic:Unexpected update of my scout installation
Goto Forum:
  


Current Time: Sun Oct 26 06:07:11 GMT 2014

Powered by FUDForum. Page generated in 0.02629 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software