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

Save Variables or Parameters to local DBF table

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

    Save Variables or Parameters to local DBF table

    I need to save and recover variable values from a local DBF table
    as a result of variable scope issues (terrible in A5v11).

    I have found scripts/instructions for doing this if you are using a
    true RDBMS (e.g., Oracle), but at present my app is still in early
    development and the tables are local DBFs.

    If you have an example of OPEN, QUERY, CLOSE statements for
    a DBF I would be appreciative.

    Ultimately I need to do the equivalent of a SELECT, INSERT, and
    UPDATE on a single row in the table.

    I've been reading/searching and have found a several commands
    (my "open" and "close" work) but I haven't been able to save
    and recover data successfully yet.

    Thanks.

    #2
    Re: Save Variables or Parameters to local DBF table

    Alrighty. One more push (now 2:45am).

    Trial and error produced this simple method. Perhaps overly simple. But...
    1. Created a simple DBF table called "ADMIN_VARIABLES"
    2. The table has a field "AdmVars_VarName" and another "AdmVars_VarVal_Char" (for character values)
    3. A5v11 presumes that DBF is local and use the standard path
    4. So the table is opened
    5. A simple search is done
    6. The original value is recovered to a variable
    7. The value is tested and toggled (useful when using an ACTION BUTTON to hide and unhide fields)
    8. and for simple feedback, a tiny ALERT is sent back in table form with the ORIGINAL and FINAL values


    �---
    �- This function is called by a button or click using an ajax callback
    �-
    �- It will recover a value from a table named �ADMIN_VARIABLES�
    �- and then toggle it from T (true) to F (false) and back again.

    �- Exports a javascript alert message with the original and final values.
    �--
    function getTestVar as c (e as p)
    'debug(1)

    '---
    '- These commands are for local DBF tables
    �-
    �- NOTE: the �vl� prefix is something I used to denote �variable, local�
    �- as opposed to �vs� for �variable, session� or �va� for �variable, admin�
    '---
    'Create a connection variable.
    dim vl_connect as P

    'Create a variable for number of records returned
    dim vl_numrecs as N

    'Create variables for original and potentially-modified results
    dim vl_varval_original as C = ""
    dim vl_varval_final as C = ""

    'Open the table.
    vl_connect = table.open("[PathAlias.ADB_Path]\admin_variables.dbf")

    'Order the table
    vl_connect.order("admvars_varname")

    'Search for desired record(s)
    vl_numrecs = vl_connect.fetch_find("Test_Variable")
    ' or... fetch_find(inv_item->product_id)

    ' If a record exists, test its value.
    if vl_numrecs > 0 then

    'Variable located... pick up the desired field value
    vl_varval_original = vl_connect.admvars_varval_char

    'Toggle the value (as a sample action)
    if vl_varval_original = "T" then
    vl_varval_final = "F"
    else
    vl_varval_final = "T"
    end if

    'Save the value (requires managing the MODE)
    vl_connect.change_begin()
    vl_connect.admvars_varval_char = vl_varval_final
    vl_connect.change_end()

    else

    'Variable NOT located
    vl_varval_final = "NO_VARIABLE_LOCATED"

    end if

    'Close table
    vl_connect.close()



    ' Compose a return string (which MUST be a bit of javascript code)
    jsText = "A5.msgBox.show('<table width=432 border="+chr(34)+"1"+chr(34)+" bgcolor="+chr(34)+"#ffe187"+chr(34)+"><tr><td><b>Alert!</b></td></tr></table>','<table width=432 border="+chr(34)+"1"+chr(34)+" bgcolor="+chr(34)+"#fff6db"+chr(34)+"><tr><td>Original value:</td><td>["+convert_type(vl_varval_original,"c")+"]</td></tr><tr><td>Final value:</td><td>["+convert_type(vl_varval_final,"c")+"]</td></tr></table>','none',function() {});"

    ' A variable of the same name as the function will receive (and deliver) the desired return value (e.g. jsText)
    getFlagVarUserDefined = jsText

    end function


    And here's what the result looks like (it toggles back and forth).

    I hope it helps someone else.

    Comment

    Working...
    X