Can't find function - Weird Error


TheNovice

Recommended Posts

Hi,

I have been using Daqfactory for quite a while now. Are there some changes lately?

Today I was creating a simple new file to collect data and push it to sql server, and I noticed I am not able to run even simple function which I use to use previously.

So I created a new file added a sequence(TempSeq) created a Temp Function as:
Function TempFn()

?"abcd"

Private string TempName = "ab"

?TempName

EndFunction

Apply, Compiled and saved the file.*

When I try to run the function using command TempFn()/?TempFn() it say channel or function not found.

 

The above same issue is happening with all my functions I am creating since yesterday.

I am pretty much doing the same thing which we use to do always, but seems there is some weird problem since past couple days.

 

Is there anything I am missing?

 

Thanks!

Edited by TheNovice
Added content
Link to comment
Share on other sites

Damn, never noticed that, but I had same name previously. Thanks.

Also, I have had multiple functions inside the same sequence, and it has worked fine, any tips about naming sequence/function when having multiple function in same sequence?

Thanks again. 

 

Link to comment
Share on other sites

Basically, the first function in a sequence, whether just script, or defined with "function" like you did, gets the name of the sequence, not the name specified in the "function" declaration.  Any subsequent functions will keep their names and be global.  This is actually an unintended "feature" that came out of compiling classes.  So basically:

sequence foo:

// script a

function xyz()
   // script b
endfunction

will create two functions, one named foo() that runs script a, and one named xyz that runs script b.  Only script A will be executed if you do beginseq(foo), and you can't do beginseq(xyz).  XYZ() can only be called as a function.

Same goes here:

sequence foo:

function abc()
   // script a
endfunction

function xyz()
   // script b
endfunction

Even though you declared abc() as a function, since it is the first function in the sequence, it will get the name foo, not abc.  

Note that none of this applies in a class:

sequence foo:

class CMyClass

   function abc()
      //script a
   endfunction

   function xyz()
      // script b
   endfunction

endclass

Both abc() and xyz() are member functions of CMyClass.  The name of the sequence is not used by the class itself.  Of course a class declaration does nothing until it is instantiated using new().  So unlike my first examples, abc() and xyz() in CMyClass don't exist until CMyClass is instantiated, and then don't appear in the global namespace.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.