Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aDzxp-0000re-Vw for pgsql-php@arkaria.postgresql.org; Tue, 29 Dec 2015 19:29:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aDzxo-0001QZ-SA for pgsql-php@arkaria.postgresql.org; Tue, 29 Dec 2015 19:29:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDzxD-0000im-JJ for pgsql-php@postgresql.org; Tue, 29 Dec 2015 19:29:07 +0000 Received: from teladesign.vm.bytemark.co.uk ([89.16.172.204]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aDzxA-0004ji-Bn for pgsql-php@postgresql.org; Tue, 29 Dec 2015 19:29:06 +0000 Received: from [109.76.177.57] (helo=[127.0.0.1]) by teladesign.vm.bytemark.co.uk with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aDzx8-0003bU-3N; Tue, 29 Dec 2015 19:29:02 +0000 Reply-To: rod@iol.ie Subject: Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql References: <5682B63E.9030008@iol.ie> <5682BBF3.1020605@iol.ie> <5682C041.40706@iol.ie> <5682CE53.1030409@iol.ie> To: Killian Driscoll , PostgreSQLPHP From: Raymond O'Donnell Message-ID: <5682DEF5.90909@iol.ie> Date: Tue, 29 Dec 2015 19:28:53 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-php Precedence: bulk Sender: pgsql-php-owner@postgresql.org On 29/12/2015 18:28, Killian Driscoll wrote: > Not sure what went wrong, but there's an error: here is the php produced > by the generator: the data show surveypoints instead of countries, but > using the same lookup principle: > > $lookupDataset = new TableDataset( > new PgConnectionFactory(), > GetConnectionOptions(), > '"irll"."surveypoint_type"'); > $field = new IntegerField('surveypoint_type_id', null, null, > true); > $field->SetIsNotNull(true); > $lookupDataset->AddField($field, true); > $field = new StringField('surveypoint_type_name'); > $lookupDataset->AddField($field, false); > $field = new StringField('surveypoint_type_description'); > $lookupDataset->AddField($field, false); > $lookupDataset->setOrderByField('surveypoint_type_name', > GetOrderTypeAsSQL(otAscending)); > > $lookupDataset->AddCustomCondition(EnvVariablesUtils::EvaluateVariableTemplate($this->GetColumnVariableContainer(), > 'exists select 1 from surveypoint ct > inner join surveypoint_type lt on (ct.surveypoint_type_id = > lt.surveypoint_type_id)')); > > $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateLookupSearchInput('surveypoint_type_id', > $this->RenderText('Survey point Type'), $lookupDataset, > 'surveypoint_type_id', 'surveypoint_type_name', false, 0)); I'm afraid I don't know whatever framework you're using. Have you any way of getting it to generate the actual SQL query? Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie -- Sent via pgsql-php mailing list (pgsql-php@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-php