Omnis Studio v10.1 Basic Web Dev
Martin Obongita
martin.obongita at yahoo.com
Thu Sep 17 07:49:19 EDT 2020
Dear Phil,
When the Save button in the remote form is clicked on, the below method will call the table class "taDepartments" method to check for duplicates before updating records:
On evClick
Do method $validateZeroValues
If iNewRecord
Do iDepartmentList.$DuplicateNew(iDepartCode,iDepartDesc) Returns lvFlag
Else
If iDepartmentDescription<>iDepartmentDescriptionOld
Do iDepartmentList.$DuplicateEditDescription(iDepartmentDescriptionOld,iDepartmentDescriptionNew) Returns lvFlag
If not(lvFlag)
Quit method
End If
End If
Best,Martin.
On Thursday, September 17, 2020, 1:33:49 PM GMT+3, Phil via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
Hi Martin,
For the avoidance of doubt, presumably you are executing this statement
somewhere, and then fetching the results?
Some lines like this:
Do toSession.$newstatement('PG') Returns lsStatement
Do lsStatement.$execdirect(pcSQL) Returns lnResult
Do lsStatement.$fetch(pcResults,pcResults.$linemax)
Phil.
On 17/09/2020 11:14, Martin Obongita wrote:
> Dear Rocco,
>
> I have amended the code thus:
>
> Begin statement
>
> Sta:SELECT description FROM departments
>
> Sta:WHERE description = @[pDepartmentDescription]
>
> End statement
>
> IfkTrue
>
> OK message'Duplicate department'
>
> Quit methodkFalse
>
> End If
>
> When I execute this method, the flag is set to kTrue and yet there is
> no matching record. The same script in sql query browser returns zero
> records.
>
> Regards,
> Martin.
>
>
>
>
>
>
> On Thursday, September 17, 2020, 12:20:36 PM GMT+3, Phil (OmnisList)
> via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
>
> Hi Martin,
>
> Was it a typo in the email, or is there no space between select and
> name, I think that won't help.
>
> and as Rocco said, you only need the name='xx' in the where clause.
>
> regards
> Phil Potter
> Based in Chester in the UK.
>
> On 17/09/2020 07:54, Martin Obongita via omnisdev-en wrote:
> > Dear All,
> > I have a department sql table with columns “id” and“name”
> > In the “departments” table class I have a method to checkfor
> duplicate “name” column.
> >
> > I therefore pass a parameter of the old name and the newname to
> check for an existing department name.
> >
> > Begin statement
> >
> > Sta:SELECTname FROM departments
> >
> > Sta:WHERE name= @[pDepartmentName] AND name <> @[pDepartmentNameOld]
> >
> > End statement
> >
> > When I execute the method, the flag is set to kTrue andyet there is
> no matching record found.
> >
> > I have run this statement in the sql query builder in thedatabase
> and no record is found.
> > Where am I missing something?
> > Best regards,Martin Obongita.
> >
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> <mailto:omnisdev-en at lists.omnis-dev.com>
--
P G Potter, 11 Regency Court, Mickle Trafford, Chester, UK.
This message is confidential and intended for the use only of the person
to whom it is addressed. If you are not the intended recipient you are
strictly prohibited from reading, disseminating, copying, printing,
re-transmitting or using this message or its contents in any way.
Opinions, conclusions and other information expressed in this message
are not given or authorised by the Company unless otherwise indicated by
an authorised representative independent of this message. The Company
does not accept liability for any data corruption, interception or
amendment to any e-mail or the consequences thereof. Emails addressed to
individuals may not necessarily be read by that person unless they are
in the office.
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list