NetTalk Central

Author Topic: Compile Errors using String theory  (Read 5202 times)

Richard I

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
    • Email
Compile Errors using String theory
« on: March 27, 2019, 02:40:54 PM »
Hi,
 Im trying to use String Theory to test whether an entered email address is valid.
 I have this in the code
         st.SetValue(lemailaddress)
         if st.ContainsA('@') = false
         p_web.setMessage('Not a Valid Email address','',false)         
         loc:Alert = 'Your email address does not appear to be valid, and was not recorded, please retry'
          p_web.SetValue('retry','RecordClocking')
         end

It wont compile-
4 errors
Unknown procedure label
Field not found: setvalue
unknown function label
field not found: ContainsA

I do have String Theory Global Extention template loaded.

What have I missed ?
Cheers
Richard
NT 11.07
ST   3.06


Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: Compile Errors using String theory
« Reply #1 on: March 27, 2019, 07:00:06 PM »
Sounds as if you haven't created the instance you're trying to use.

Do you have a StringTheory object named st in the procedure where your checking code lives (or a global object with that name that you're using)?

Jane

Richard I

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
    • Email
Re: Compile Errors using String theory
« Reply #2 on: March 27, 2019, 07:13:31 PM »
Thanks Jane,
No
St  or St. ??
local variable?
what about the "containsA ?
Should that be also?

Cheers
Richard

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: Compile Errors using String theory
« Reply #3 on: March 27, 2019, 07:21:55 PM »
Pardon me if I'm misreading your confusion, Richard.

You have the global template in your app.  Therefore, StringTheory is available.

But as with any other class/object-based code, you need an instance of it to work with.

When you create an instance in your procedure, then the methods st.SetValue, st.ContainsA, etc. will be available. 
(Assuming you've named your instance st  )

In the DATA section of your procedure (somewhere above the CODE statement), try inserting this line

st       StringTheory

so you're creating a StringTheory object in that procedure with the name "st". 
Then see if the rest of your code compiles.

Hope that helps.

Jane


Richard I

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
    • Email
Re: Compile Errors using String theory
« Reply #4 on: March 27, 2019, 07:30:27 PM »
Thanks Jane,
Got it.

perhaps the help files were not quite clear enough...

Cheers
Richard