Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

    I came across this other thread:

    Originally posted by Selwyn Rabins View Post
    you can use the eval() function.


    eval("e._state.keys.alpha"+i+"._key") = i

    I don't quite understand why eval() was used here, I had seen a thread stating EVALUATE_TEMPLATE() was the correct way.
    I just took another look at the three functions EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION() and then...
    I subsequently reviewed Code Indirection Info in the wiki: http://wiki.alphasoftware.com/Code+Indirection

    ....Now I'm more confused than before, having seen Selwyn's post in this other thread!

    Why eval() and not EVALUATE_TEMPLATE()? ~ And whilst were on this subject, whats the difference between using either of these vs. A5_EVAL_EXPRESSION()? Initially, I had read (at least understood/interpreted) elsewhere on this forum, that EVALUATE_TEMPLATE() was supposed to be the correct function to use...

    Are these all redundant functions?
    Robert T. ~ "I enjoy manipulating data... just not my data."
    It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
    RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

    #2
    Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

    Robert, I think I can help a bit.

    EVAL() always returns the result of the expression being evaluated.

    EVALUATE_TEMPLATE() never returns a result, it simply executes the commands within the expression.

    Comment


      #3
      Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

      They are different. Examples:

      evaluate_template("dim c1 as c = \"sdf\"")
      ?c1
      = "sdf"

      eval("dim c2 as c = \"asf\"")
      ERROR: Variable "dim c2 as c" not found.

      ''''''''''''''''''''''''''''
      ?evaluate_template("1 + 2")
      = ""

      ?eval("1 + 2")
      = 3
      '''''''''''''''''''''''''''''''''''''
      a = 1
      b = 2
      ?evaluate_template("a + b")

      ?eval("a + b")
      = 3

      I've never used the eval_expression one but the wiki says how it is different from the others.
      Steve Wood
      See my profile on IADN

      Comment


        #4
        Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

        I think they all have their place. You could likely accomplish the script below with evaluate_template() but I'd hate to try.


        Code:
        sw = val(mlk_wk)
        uwk0 = padl(alltrim(str((sw))),3,"0")
        uwk1 = if(val(padl(alltrim(str((sw-1))),3,"0"))>0,padl(alltrim(str((sw-1))),3,"0"),padl(alltrim(str((sw-1+52))),3,"0"))
        uwk2 = if(val(padl(alltrim(str((sw-2))),3,"0"))>0,padl(alltrim(str((sw-2))),3,"0"),padl(alltrim(str((sw-2+52))),3,"0"))
        uwk3 = if(val(padl(alltrim(str((sw-3))),3,"0"))>0,padl(alltrim(str((sw-3))),3,"0"),padl(alltrim(str((sw-3+52))),3,"0"))
        uwk4 = if(val(padl(alltrim(str((sw-4))),3,"0"))>0,padl(alltrim(str((sw-4))),3,"0"),padl(alltrim(str((sw-4+52))),3,"0"))
        uwk5 = if(val(padl(alltrim(str((sw-5))),3,"0"))>0,padl(alltrim(str((sw-5))),3,"0"),padl(alltrim(str((sw-5+52))),3,"0"))
        uwk6 = if(val(padl(alltrim(str((sw-6))),3,"0"))>0,padl(alltrim(str((sw-6))),3,"0"),padl(alltrim(str((sw-6+52))),3,"0"))
        uwk7 = if(val(padl(alltrim(str((sw-7))),3,"0"))>0,padl(alltrim(str((sw-7))),3,"0"),padl(alltrim(str((sw-7+52))),3,"0"))
        uwk8 = if(val(padl(alltrim(str((sw-8))),3,"0"))>0,padl(alltrim(str((sw-8))),3,"0"),padl(alltrim(str((sw-8+52))),3,"0"))
        uwk9 = if(val(padl(alltrim(str((sw-9))),3,"0"))>0,padl(alltrim(str((sw-9))),3,"0"),padl(alltrim(str((sw-9+52))),3,"0"))
        uwk10 = if(val(padl(alltrim(str((sw-10))),3,"0"))>0,padl(alltrim(str((sw-10))),3,"0"),padl(alltrim(str((sw-10+52))),3,"0"))
        uwk11 = if(val(padl(alltrim(str((sw-11))),3,"0"))>0,padl(alltrim(str((sw-11))),3,"0"),padl(alltrim(str((sw-11+52))),3,"0"))
        uwk12 = if(val(padl(alltrim(str((sw-12))),3,"0"))>0,padl(alltrim(str((sw-12))),3,"0"),padl(alltrim(str((sw-12+52))),3,"0"))
        
        a_tbl = table.open("milkfile",FILE_RW_EXCLUSIVE)
        flds = a_tbl.fields_get()
        mlist = ""
        FOR i = 1 TO flds
        	fname = a_tbl.field_get(i).name_get()
        	IF left(fname,1) = "M"
        		mlist = mlist+if(len(mlist)>0,",","")+fname
        	END IF
        NEXT i
        pflds = w_count(mlist)
        query.order = ""
        query.filter = ".T."
        query.options = "I"
        query.description = "Temporary Query"
        ix = a_tbl.query_create()
        post.m_count = pflds
        post.t_db = "WSS"
        post.m_key = "PADL(alltrim(Upc),13,\"0\")"
        post.t_key = "UPC"
        post.m_filter = ""
        post.t_filter = ""
        pf = "post.m_field"
        pe = "post.m_exp"
        for x = 1 to pflds
        	pfld = pf+alltrim(str(x))
        	pexp = quote(word(mlist,x))
        	pstore = stritran(pexp,"M","")
        	eval(pfld) = UNQUOTE2(pexp)
        	pexpv = pe+alltrim(str(x))
        	eval(pexpv) = "if(@Wss->Store="+(pstore)+",@WSS->W"+var->uwk0+"u+@WSS->W"+var->uwk1+"u+@WSS->W"+var->uwk2\
        	+"u+@WSS->W"+var->uwk3+"u+@WSS->W"+var->uwk4+"u+@WSS->W"+var->uwk5+"u+@WSS->W"+var->uwk6+"u+@WSS->W"+var->uwk7\
        	+"u+@WSS->W"+var->uwk8+"u+@WSS->W"+var->uwk9+"u+@WSS->W"+var->uwk10+"u+@WSS->W"+var->uwk11+"u+@WSS->W"+var->uwk12+"u,M"+unquote2(pstore)+")"
        next x
        post.t_count = 0
        a_tbl.post()
        a_tbl.close()
        There can be only one.

        Comment


          #5
          Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

          I bet Ira could reduce that to one *for_each() statement :)
          Steve Wood
          See my profile on IADN

          Comment


            #6
            Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

            Probably, but it would make me cry if he did. I just hack at it till it works and then move on.

            FWIW this is a self generating posting operation where the fields to be posted to are named like

            M001, M002, ..., M474

            When a new field is added or deleted, the code adjusts itself.
            There can be only one.

            Comment


              #7
              Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

              Thanks everyone, this all makes sense.... (except for that huge listing of code I'm not even going to mentally parse.)

              But to take this one further, how could one (presumably) use one of these EVAL's to assign the value stored in a calculated field into a variable?

              I know I could do it using a hidden field to store the value, but there must be another way.
              ~When I try to use drag & drop (from the XbE, all i get is total().

              Using the Alpha Sports db, I did come up with the following code that work on the invoice screen:

              Prerequisite: I created the following calculated field: vxyTotals = total(Invoice_Items->Price,grp->Invoice_header)
              It works properly when placing the value in a field.

              NOTE: All I get from using XbE (drag & drop) is Invoice:Calculated:vxyTotals = total() (or) vxyTotals = total().

              So I then wrote this snippet:

              Code:
              [B]dim vp_vxyTotals as p
              dim vc_vxyTotals as c[/B]
              
              [COLOR="#D3D3D3"]'dim vp_localVars as P
              'vp_localVars = local_variables() 'define pointer to local_variables() NOTE:  Could embed.. [/COLOR]
              
              [B]vp_vxyTotals = calculated_field_get(local_variables(),"vxyTotals")[/B] 'get pointer to calculated field
              [COLOR="#D3D3D3"]'vp_vxyTotals = calculated_field_get(vp_localVars,"vxyTotals") 'get pointer to local variable[/COLOR]
              [B]vc_vxyTotals=vp_vxyTotals.VALUE_GET()[/B] 'get value from pointer
              
              [B]ui_msg_box("",vc_vxyTotals,UI_INFORMATION_SYMBOL)[/B] 'this does work, but.....
              It works, but isn't there a single function or line of code that could do this?
              Robert T. ~ "I enjoy manipulating data... just not my data."
              It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
              RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

              Comment


                #8
                Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                You could just

                Code:
                vc_vxyTotals= calculated_field_get(local_variables(),"vxyTotals").VALUE_GET()
                There can be only one.

                Comment


                  #9
                  Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                  Hi Stan,

                  Originally posted by Stan Mathews View Post
                  Probably, but it would make me cry if he did.
                  I don't want to make you cry. I'll let it sit as is.

                  Clarifications
                  • Eval() is for evaluating an a text string as an expression and can be used anywhere an expression is used. The expression is evaluated in the current local variable space, unless overridden by the 2nd parameter
                  • Eval() can also be used on the left side of an assignment, the only function that can be (and we mean at the "top" level, not within an array index on the left side which is OK for any expression) ( as in var1=254) to use the resulting string as the destination for an assignment ( as in eval("var"+ltrim(str(1)))=254 However the value 1 would most likely be some variable of number type in this case)
                  • evaluate_template() evaluates the text in it's parameter as a Xbasic code (of any number of lines). Note, you can only use goto and label lines that are in that Xbasic code of the parameter text
                  • A5_eval_expression() is a "wrapper code" used mostly for genies, that returns the expression parameter if the 1st non-blank character is not an =, otherwise if it is an =, it tries an eval() of the expression in the current variable space, then tries it in the form/browse/other layout's variable space, and lastly tries in the variable space of an optional 2nd parameter pointer to a variable space. There is probably never a reason for using this function. It is slow in speed (requiring up to 4 eval() if earlier ones fail), and if you have the 2nd parameter, it should have tried that one 1st. But your code should know what space to evaluate the code in.


                  eval() could be used on both the left and right of an assignment, as in

                  eval("var")=eval("123+456")

                  but you could also generate the whole string and use an evaluate_template() to evaluate the whole line of code as in

                  evaluate_template("var"+"="+"123+456")

                  As to Robert's question, no you can't. I don't believe you can get the calculated field results from a layout straight into a variable. That is code that predates most of XBasic. However, if the calculated field is a field placed on the form, you can retrieve the value of that field, which can be placed into a variable. The better way is to just calculate the values in the onfetch event into variables, then display the variables. If a field used in the calculation is changed, you can recalculate the variable and refresh the form.
                  Regards,

                  Ira J. Perlow
                  Computer Systems Design


                  CSDA A5 Products
                  New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                  CSDA Barcode Functions

                  CSDA Code Utility
                  CSDA Screen Capture


                  Comment


                    #10
                    Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                    Here is an example of eval(). It is in a FOR loop to build value for "lst".

                    ...
                    lst = lst + arr_vars[x].footer_id + ":" + eval("session."+prot + arr_vars[x].var_name)+"|"
                    ?lst
                    ...

                    Lst will end up containing something like this, depending on values in the array arr_vars[] and the other variables:

                    "myid:12345|myotherid:abcde"

                    It is just a concatenation of several strings, the eval() portion returns a string and then executes that string. For instance if the value inside eval() is "session.__protected__myid" it will give me the contents of that session variable. Obviously code above this snipit ensures the session var exists; the command would fire an error if it did not exist (e.g., was an invalid expression).

                    You left out evaluate_string() in your list. I use that most often to make my code easier to read.

                    cc = "Steve"
                    c1 = "My name is {cc}"
                    ?evaluate_string(c1)
                    In a more complex situation, that would create code easier to read than
                    c1 = "My name is "+cc
                    ?c1

                    A better example:
                    req_body = <<%txt%
                    serialnumber={serialnumber}
                    &sjname=NA
                    &streetaddress={address}
                    &city={city}
                    &state=XX
                    &zipcode=00000
                    &shiptophone=0000000000
                    &email={email}
                    &ordernumber={orderid}
                    &orderstring=1~My Trip~100~1~N~||
                    &transactionamount={transamt}
                    &accountnumber={remspecial(accountnumber)}
                    %txt%
                    req_body = evaluate_string(req_body)
                    req_body = stritran(req_body,crlf())
                    Note - the wiki describes a more effecient method as a replacement for evaluate_string() but I have never used it.
                    Steve Wood
                    See my profile on IADN

                    Comment


                      #11
                      Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                      .... Another question/problem when using the eval() function:

                      It's my understanding that eval both uses and returns variables of type char.
                      Yet when combined with the obj() function, a strange thing seems to happen and I can't understand exactly why.
                      It seems to me that the line of code highlighted in red should resolve.

                      NOTE:
                      I added a button to the Alpha Sports Products Form (desktop) and attached the following code to the OnPush event:
                      (and added the vp_Table watch variable in the debugger to see what does and doesn't work/resolve)

                      Code:
                      debug(1)
                      '[COLOR="#0000CD"][B]SINCE THESE ALL WORK:[/B][/COLOR]
                      [B]dim vp_Table as P = obj("Products:Tables:Product") ' -OK
                      dim vp_Table as P = obj("Products" + ":Tables:Product") ' -OK2
                      dim vp_Table as P = obj("topparent:Tables:Product") ' - OK3
                      dim vp_Table as P = obj(eval("topparent.name()"[COLOR="#FF0000"])[/COLOR] + ":Tables:Product") ' -OK4[/B]
                      'dim vp_Table as P = obj("topparent:Tables:Product.Name_Get()") ' - Name_Get() doesn't resolve properly because it's not appended to pointer.
                      'dim vp_Table as P = obj(eval("topparent.name()") + ":Tables:Product.Name()") ' - .Name() method does not work with table obj!
                      
                      '[COLOR="#0000CD"][B]THEN WHY DOESN'T THIS WORK?:[/B][/COLOR]
                      [B]dim vp_Table as P = obj(eval("topparent.name()" + ":Tables:Product")[COLOR="#FF0000"])[/COLOR][/B]
                      ' [B]EXTRA CHARS ERROR SHOWN IN DEBUGGER.....[COLOR="#FF0000"]*[/COLOR][/B]
                      debug(0)
                      * There are no extra characters here. And the only difference between this and OK4 (above) is placement of close parenthesis. (colored red in code above)

                      What am I missing here?
                      Last edited by SNusa; 03-13-2012, 04:28 PM.
                      Robert T. ~ "I enjoy manipulating data... just not my data."
                      It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                      RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                      Comment


                        #12
                        Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                        Hi Robert,

                        Originally posted by SNusa View Post
                        .... Another question/problem when using the eval() function:

                        It's my understanding that eval both uses and returns variables of type char.
                        That's absolutely wrong. Eval takes a string argument (which can be created as an expression like "AB"+"C+123" which is the same as "ABC+123") and evaluates it as an expression (thus it would be like ABC+123) in the context of the current code, or optionally a table with additional arguments to eval. This string when looked at as an expression (take away the quotes for thinking about it) evaluates to any valid Alpha data type. It could be a string (character), number, date, time, short time, pointer whatever!

                        As to using topparent, which is an Alpha Five alias, it may not be able to resolve topparent while inside an eval(). Instead, compute the string outside the eval, as in
                        x=topparent.name()
                        dim vp_Table as P = obj(x + ":Tables:Product")
                        Regards,

                        Ira J. Perlow
                        Computer Systems Design


                        CSDA A5 Products
                        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                        CSDA Barcode Functions

                        CSDA Code Utility
                        CSDA Screen Capture


                        Comment


                          #13
                          Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                          Originally posted by csda1 View Post
                          .....it may not be able to resolve topparent while inside an eval(). Instead, compute the string outside the eval, as in
                          x=topparent.name()
                          dim vp_Table as P = obj(x + ":Tables:Product")
                          It was able to resolve topparent properly within the eval() function. (As it works properly my "OK4" line of code above.)
                          It's the last line / example where it failed that is throwing me off. It seems to be having problems with the second half:

                          dim vp_Table as P = obj(eval("topparent.name()") + ":Tables:Product") ' WHICH WORKS FINE
                          Which is extremely close to this:
                          dim vp_Table as P = obj(eval("topparent.name()" + ":Tables:Product")) 'DOESN'T WORK

                          I'm wondering whether I AM simply parsing (assembling / combining) the code improperly in my head.....
                          Looking at the second line of code, does my logic at least appear to be correct, or is there a fundamental difference between these two lines of code? I guess what I'm asking is: Would you have expected the second line to work OK too?
                          Last edited by SNusa; 03-13-2012, 05:29 PM.
                          Robert T. ~ "I enjoy manipulating data... just not my data."
                          It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                          RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                          Comment


                            #14
                            Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                            Originally posted by SNusa View Post
                            It's the last line / example where it failed that is throwing me off. It seems to be having problems with the second half:
                            .......
                            dim vp_Table as P = obj(eval("topparent.name()" + ":Tables:Product")) 'DOESN'T WORK

                            I'm wondering whether I AM simply parsing (assembling / combining) the code improperly in my head.....
                            Looking at the second line of code, does my logic at least appear to be correct, or is there a fundamental difference between these two lines of code? I guess what I'm asking is: Would you have expected the second line to work OK too?
                            The logic is not correct. You have
                            dim vp_Table as P = obj(eval("topparent.name()" + ":Tables:Product"))
                            which simplifies to
                            dim vp_Table as P = obj(eval("topparent.name():Tables:Product"))
                            which the string in the eval is
                            topparent.name():Tables:Product
                            The previous line is not a valid expression.
                            topparent.name() returns a piece of text, but what you need there is essentially a pointer. The ":" colon could also give some issues with a pointer, so it really should be a period (.)

                            eval("topparent.name()")+":Tables:Product" simplifies to
                            "yourformname"+":Tables:Product" which simplifies to
                            "yourformname:Tables:Product" which the obj() function can use.

                            So what you see at the beginning is not the form's name but a pointer variable name that has the same name as the formname. Note if it was multiple instances of the form open, Alpha would have called the pointer variable with the formname plus a digit after it indicating the instance, as in

                            formname
                            formname0
                            formname1
                            etc.
                            Regards,

                            Ira J. Perlow
                            Computer Systems Design


                            CSDA A5 Products
                            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                            CSDA Barcode Functions

                            CSDA Code Utility
                            CSDA Screen Capture


                            Comment


                              #15
                              Re: EVAL() vs. EVALUATE_TEMPLATE() vs A5_EVAL_EXPRESSION()

                              Originally posted by csda1 View Post
                              The logic is not correct. You have.......

                              .....The ":" colon could also give some issues with a pointer, so it really should be a period (.)
                              Thanks Ira;

                              I now see why "evaluating" ("topparent.name()" + ":Tables:Product") together doesn't work. (and why the other way worked)

                              But your comment regarding possible issues when using the colon (:) instead of the period (.) are throwing me off. In these lines of code (that all work OK) which colon(s) are you referring to? (I've tried substituting out the colons for a period, and in any/all combinations, the code ONLY appears to work when the colon is used.)

                              Code:
                              dim vp_Table as P = obj("Products:Tables:Product") ' -OK
                              dim vp_Table as P = obj("Products" + ":Tables:Product") ' -OK2
                              dim vp_Table as P = obj("topparent:Tables:Product") ' - OK3
                              dim vp_Table as P = obj(eval("topparent.name()") + ":Tables:Product") ' (ALSO WORKS AS EXPECTED)
                              [B]' ~In this above instance, I'm fairly certain that isolating topparent.name() within the eval() function works.....
                              ' ~Because here, the eval() function is returning a char type value![/B]
                              In "Bob-Code" (my twisted naming conventions): I'm using the colons to "drill-down" through the "object hierarchy" (in their respective and absolute order) to make reference to a sub-object. (prior to capturing a pointer to the actual object via the obj() function)

                              From what I can tell, (from reviewing the a5 reference books I am looking at here) it appears that using the colon in this fashion is the correct (and only) way to explicitly reference these objects in this instance. .....And that using actual pointers, and or using the period (.) should not work here... ~ At least that's what this Alpha Software spiral bound reference manual is telling me. (and that's what I am seeing when I experiement.)

                              PS: I know an easier way to do this would be:
                              Code:
                              [COLOR="#0000CD"]dim vp_Table as P = parentform.table_get()
                              '-And for child tables.....
                              dim vc_Child as C = vp_Table.child_get(1)
                              dim vp_Child as P = table.get(vc_Child)[/COLOR]
                              
                              [B]' *Also, to fully qualify these other two working lines of code[/B] (copied from my original post)......
                              dim vp_Table as P = obj("Products:Tables:Product") ' -OK
                              dim vp_Table as P = obj("Products" + ":Tables:Product") ' -OK2
                              [B]' ~Technically, from what I'm looking at here....
                              ' ~You could/should actually add another[/B] [COLOR="#FF0000"][B]:[/B][/COLOR] in front of the forms name... ie:
                              dim vp_Table as P = obj("[COLOR="#FF0000"][B]:[/B][/COLOR]Products:Tables:Product") ' -OK
                              dim vp_Table as P = obj("[B][COLOR="#FF0000"][B]:[/B][/COLOR][/B]Products" + ":Tables:Product") ' -OK2
                              ~I'm just trying to get a really good grasp on all the details here!....
                              Last edited by SNusa; 03-13-2012, 11:53 PM.
                              Robert T. ~ "I enjoy manipulating data... just not my data."
                              It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                              RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                              Comment

                              Working...
                              X