Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Killian Driscoll <killiandriscoll(at)gmail(dot)com>, PostgreSQLPHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql
Date: 2015-12-29 19:28:53
Message-ID: 5682DEF5.90909@iol.ie
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-php

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(at)iol(dot)ie

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Raymond O'Donnell 2015-12-31 11:34:22 Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql
Previous Message Raymond O'Donnell 2015-12-29 18:17:55 Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql