Returning a value not recorded in the Database.

This article illustrates how to return a value that has not been recorded in the Elipse E3 Database yet.

Many times, you will need to check if a certain value has already been recorded in the Database before you try to add it. This is very important, especially when using a primary key.

First of all, SetVariableValue method atributes the value of a variable created on the Query; thus, you can inform this value as a filter or parameter before the Query takes place. You must also set up the variable’s name (VarName) and its (Value), which can be a number, a text, or a timestamp.

EOF property, from GetADORecordSet method, returns one of the following values: True, if the current record position is after the last onde, and False, if the current record position is before the last one.

With these two methods as resources, you must first search for the desired word:

  1. Set Consulta = Screen.Item(“ExistConsult”)
  2. ‘Screen.Item(“ExistConsult”).SetVariableValue(VarName, Value)
  3. Consulta.SetVariableValue “office”, Screen.Item(“TextExist”).Value

If you can’t retrieve the word, EOF property, from GetADORecordSet method, returns True:

  1. set RS = Consulta.GetADORecordset()
  2. If RS.eof = true Then
  3. msgbox “The office does not exist”
  4. Else
  5. msgbox “The office exists”
  6. end if

Therefore, you can indicate to the user if the value has already been recorded to the Database or not, or rather, of it will return a value that hasn’t been recorded in the Database.

Attached to this article is a demo application developed with Elipse E3 v5.0.437.

Related Articles:

Basic VBScript for Elipse E3: Lesson 7 – GetADORecordSet

Using Databases in E3: Chapter 6 – Editing Records

Attachments:

9489.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *