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

Script Problem

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

    Script Problem

    I am writing a script to accomplish the following:

    1. Prompt for a Property Number (based on records in the Properties table)
    2. Open a form, fetch the Property record with the number selected in step 1 and capture
    the value of 5 fields in that record.
    3. Print a report for that one record.

    To facilitate writing and checkout, I have designed a calling script which in turn calls the 4 scripts listed above. I�m currently working on the second step. I have written the script using genies. The problem segment (I think) contains the 5 commands in the area directly below the �Now capture the 5 principals into Vc_P1 thru Vc_p5. This was written with the Xbasic Script Genie | Variables | Set variable(s) to field value - fields on a form options. The script appears below:
    ----------------------------------------------------------------------------------------
    'Date Created: 24-Oct-2008 02:22:24 PM
    'Last Updated: 26-Oct-2008 05:14:09 PM
    'Created By : Howard R. Elkes
    'Updated By : Howard R. Elkes

    '*******************************************************************************
    ' Open PROPERTIES table. *
    '*******************************************************************************
    prop=table.Open("PROPERTIES",FILE_RO_SHARED)
    Vc_step = "Step FPR 1"

    '*******************************************************************************
    ' Open PROPERTIES form. *
    '*******************************************************************************
    query.filter = "Propnumber = Var->Vc_Prop"
    query.order = "recno()"
    'replace variables in the filter with their actual values
    query.filter = convert_expression(query.filter,"V")

    'Open the layout_type showing just the records that satisfy the filter
    DIM Shared varP_Properties as P
    DIM layout_name as c
    layout_name = "Properties"

    dim tempP as p
    'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
    tempP=obj(":"+object_name_normalize(word(layout_name,1,"@")))
    'Test if pointer is valid
    if is_object(tempP) then
    'Test if pointer refers to a form or browse
    if tempP.class() = "form" .or. tempP.class() = "browse" then
    dim flagIsBaseFilter as l
    flagIsBaseQuery = .t.

    if flagIsBaseFilter then
    'Apply the query to the form or browse as the Base query. (this means that
    'the user cannot turn the query off, only add to the query)
    tempP.BaseQueryRun(query.filter,query.order)
    else
    tempP.QueryRun(query.filter,query.order)

    end if

    'then activate the already open window
    tempP.activate()
    else
    'Window is not already open, so open it
    varP_Properties = :Form.viewqueried(layout_name,query.filter, query.order )

    end if
    else
    varP_Properties = :Form.viewqueried(layout_name,query.filter, query.order )

    end if
    Vc_step = "Step FPR 2"

    '*******************************************************************************
    ' Now, capture the 5 Principals into Vc_P1 thru Vc_P5. *
    '*******************************************************************************
    Vc_P1 = parentform:Prin1.value
    Vc_P2 = parentform:Prin2.value
    Vc_P3 = parentform:Prin3.value
    Vc_P4 = parentform:Prin4.value
    Vc_P5 = parentform:Prin5.value
    Vc_step = "Step FPR 3"

    '*******************************************************************************
    ' When done, close the form. *
    '*******************************************************************************
    parentform.close(.f.)
    Vc_step = "Step FPR 4"


    END
    ------------------------------------------------------------------------------------------

    However, when I attempt to run this script (FetchPropertiesRecord), I get a message which states:
    Script:FetchPropertiesRecord line:60
    Vc_P1 = parentform:Prin1.value
    Not found
    Parentform:Prin1 not found.

    However, there IS a Properties form based on the Properties table which I have designed and which contains all the fields in that table - including Prin1 through Prin5.

    Any ideas as to what�s wrong with the genie-created script?

    #2
    Re: Script Problem

    Hi Howard,

    See what happens when you DIM your variables.

    Let us know.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: Script Problem

      Howard, you can't use the relative object address "Parentform" unless the script is running within that form's session. Alpha is probably having trouble resolving what object "Parentform" is referencing since the script itself is running before the form is opened. From the perspective of the running script it does have a "parentform", if you see what I mean.

      I think the fix will be to use a reference that points to the newly opened form, like this:

      Vc_P1 = varP_Properties:Prin1.value


      Also since the report you want to run will run in its own session I suggest you make any variables that will be needed in the report global in scope.
      Last edited by Tom Cone Jr; 10-27-2008, 06:52 AM.

      Comment


        #4
        Re: Script Problem

        Thanks to both Keith Hubert and Tom Cone, Jr. for their unbelievably quick responses!

        Keith: The variables are DIMmed in the calling script.

        Tom: You hit it on the nose. I modified the script as you suggested, and it worked perfectly.

        I doubt that there is another software supplier that has as loyal (and knowledgeable) a group of users.

        Thanks again.

        Howard

        Comment


          #5
          Re: Script Problem

          Howard, I'm glad you got it going inspite of the error in my text. I meant to say:

          From the perspective of the running script it does not have a "parentform", if you see what I mean.

          Comment

          Working...
          X