Recommended Posts

Posted (edited)

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

Share this post


Link to post
Share on other sites

The function has to be the same name as the sequence unless it is contained in a class.

Share this post


Link to post
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. 

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Interesting and good to know! I'll keep that in mind now.

Thank you so much for your help was banging my head since past 2 days, trying different things.

Thanks again!!

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now