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

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

  • EVAL

    I am building an application that is to be used for registering students and course management of 1 to 5 courses.
    I have a booking table with 2 series of relating fields:
    Kx_booked, where x can be 1 to 5
    Cx_granted, that relates to the Kx_booked field
    There is another field that holds the course indicator K1 through K5.
    In a first stage a reservation is made for a certain course and the Kx_booked field is set to true.
    At the end of a particular course, when it is confirmed that a student showed up and followed that course, the Cx_granted field is to be set to true. A script will be launched by a button push and will update the Cx_granted fields.
    The script works but after having another look I lost some confidence as to the use of the EVAL statement. Using the debugger didn't help me boosting my confidence again.

    Script.

    dim invh as p
    dim tbl as p
    dim qry as p
    dim numbr as c
    dim recs as n
    dim kind as c
    dim kind2 as c
    invh=table.get("courses") 'Parent table in the set
    on error goto errors
    numbr=invh.Id 'Populate variable with course number fields from the courses table
    tbl=table.open("booking") 'One of the child tables in the set
    query.filter="Course_Id=var->numbr"
    query.order="Pers_id"
    query.options="N"
    query.decription="Number Item Lines"
    qry=tbl.query_create()
    recs=qry.records_get()
    'ui_msg_box("",str(recs)+"") 'Can be commented out. Shows # child records relating to Invh table
    tbl.fetch_first()
    'debug(1)
    while .not. tbl.fetch_eof()
    kind = "C" + right(invh.K_connector,1) + "_granted"
    kind2 = alltrim(invh.K_connector)
    tbl.change_begin() 'Put child table into change mode
    eval("tbl." + var->kind) = var->kind2
    tbl.Course_Fin = .T.
    tbl.change_end(.t.) 'end the change mode
    tbl.fetch_next() 'fetch until last matching child record has been fetched
    end while
    tbl.close() 'close child table
    'set course to finished
    if invh.Id = var->numbr
    invh.change_begin()
    invh.Course_Fin = .T.
    invh.change_end(.t.) 'end change mode
    end if
    end
    -----------

    The result of the eval statement is .T. but looking at it I would have expected another value stored in kind2 = alltrim(invh.K_connector).

    Am I correct in my assuption?
    Thanks,
    Jo Hulsen
    Dommel Valley Solutions
    The Netherlands

  • #2
    Re: EVAL

    The statement

    eval("tbl." + var->kind) = var->kind2

    assigns the value in var->kind2 to the designated table field. I suppose it evaluates to true if it succeeds.

    Run the script again and hit F12 until you reach

    eval("tbl." + var->kind) = var->kind2

    Fill in the example fields at the bottom left to see what values are present.
    There can be only one.

    Comment


    • #3
      Re: EVAL

      Stan,

      Thanks for your explanation, including the private one.
      I did another run with the debugger and result is attached.
      I couldn't get the expression in as you suggested in line3 of your attachment. Nevertheless I believe it must be that the eval statement is resulting to .T.
      Equality is already there by means of equality in the digit portion(C1 versus K1), by this I mean that the correct fields are paired; Field C1_granted is paired by the value of var->kind2 (K1) with field K1_booked.

      So, looking back at the statement leads to the conclusion that the current result is sheer luck as I meant to set the field C1_granted to true.
      Forgot to mention that both fields involved are logical fields. Records handled by this script always have field K1_booked set to .T.
      The eval statement could look like this:
      eval("tbl." + var->kind) = .T.
      and lead to the same result I guess?

      Thanks,
      Jo Hulsen
      Dommel Valley Solutions
      The Netherlands

      Comment


      • #4
        Re: EVAL

        Something went wrong with the attachment.
        Jo Hulsen
        Dommel Valley Solutions
        The Netherlands

        Comment


        • #5
          Re: EVAL

          The eval statement could look like this:
          eval("tbl." + var->kind) = .T.
          and lead to the same result I guess?
          Yes.
          There can be only one.

          Comment

          Working...
          X