Postgres query into Omnis question

Steve Finger steve at srptech.com
Tue Mar 28 16:47:59 EDT 2017


Hi Mayada,

Yes that did work!

So now I have two solutions as Dan Ridinger had a solution also.

Thank you very much,

Steve


> On Mar 28, 2017, at 4:41 PM, Mayada Al-Kishtini <malkishtini at gmail.com> wrote:
> 
> Sorry, this should work:
> 
> Select order_number, order_comments:: varchar(2000)
> from  order_forecast 
> UNION 
> select order_number, null::  varchar(2000) as order_comments    ---- the error might be from order_comments , it should be after the cast
> from orders
> 
> Mayada
> 
> -----Original Message-----
> From: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] On Behalf Of Steve Finger
> Sent: Tuesday, March 28, 2017 4:24 PM
> To: OmnisDev - English
> Subject: Re: Postgres query into Omnis question
> 
> Hi Mayada,
> 
> Trying this gave me SQL errors.
> 
> Thanks for the idea. I might try different combinations of your suggestion.
> 
> Thanks,
> 
> Steve
>> On Mar 28, 2017, at 4:10 PM, Mayada Al-Kishtini <malkishtini at gmail.com> wrote:
>> 
>> Hi Steve,
>> 
>> Try
>> select order_number, order_comments:: varchar(2000) from 
>> order_forecast UNION select order_number, null as order_comments :: 
>> varchar(2000)  from orders
>> 
>> Mayada
>> 
>> -----Original Message-----
>> From: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] On 
>> Behalf Of Steve Finger
>> Sent: Tuesday, March 28, 2017 3:52 PM
>> To: OmnisDev - English
>> Subject: Postgres query into Omnis question
>> 
>> Hi,
>> 
>> I’m using Studio 6.1.3 to do a query to Postgres. To simplify, here is an example of what I’m trying to do:
>> 
>> select order_number, order_comments
>> from order_forecast
>> UNION
>> select order_number, null as order_comments from orders
>> 
>> 
>> Then I fetch the result into an undefined Omnis list. Currently only the orders table has values.
>> 
>> The problem is what Omnis brings back into the list. The order_comments column doesn’t have a length. So in an Omnis window which has a complex grid to display and enter values into the order_comments field, nothing can be typed in.
>> 
>> If I change null to ‘ ‘ (1 space) in the query then the column is defined with a length of 1.
>> 
>> The database table is set to 2000 characters.
>> 
>> How can I modify the query so Omnis knows that the length of the column that is returned from the query should allow 2000 characters? Or am I going to have to redefine the list in Omnis?
>> 
>> Thanks,
>> Steve Finger
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> 
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com





More information about the omnisdev-en mailing list