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

Adding records with code

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

  • Tom Cone Jr
    replied
    Re: Adding records with code

    Shelley,
    this message board can serve as a sort of knowledgebase if we limit each thread of messages to a single topic or question. Otherwise a single thread turns into a blog as the original poster builds his or her application, encountering and overcoming one problem after another. Anyone searching the board for help on a particular issue might find the blog, but then have to wade through all the posts just to find the item of interest. See what I mean?
    I guess the answer to my question was no.

    Please post new questions in new threads. Thanks.

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Adding records with code

    [ deleted ]
    Last edited by Tom Cone Jr; 03-02-2013, 07:27 AM.

    Leave a comment:


  • Stan Mathews
    replied
    Re: Adding records with code

    Did you make the new index active with tbl.index_primary_put("your_index_name")?

    Open AlphaSports, create a button on the Customer Information form. Put this code on the button onpush event.

    Code:
    tofind = ui_get_text("Last Name","Enter Name to find.","Adams")
    tbl = table.current()
    tbl.index_primary_put("Lastname1")
    rec = tbl.fetch_find(tofind)
    if rec > 0 'found a match
    	ui_msg_box("Success","There is a record for an "+tofind)
    else
    	ui_msg_box("Sorry","There are no records for "+tofind)
    end if
    or just create a new script on the code tab and use

    Code:
    tofind = ui_get_text("Last Name","Enter Name to find.","Adams")
    tbl = table.open("customer")
    tbl.index_primary_put("Lastname1")
    rec = tbl.fetch_find(tofind)
    if rec > 0 'found a match
    	ui_msg_box("Success","There is a record for an "+tofind)
    else
    	ui_msg_box("Sorry","There are no records for "+tofind)
    end if

    Leave a comment:


  • garland_owl_1966
    replied
    Re: Adding records with code

    It did not work, but gives me another direction. I tried .fetch_find(). I created an index dtos(Order_Fri). I created a vDate2 as c. I made vDate2 = dtos(vDate). I then plugged .fetch_find(vDate2), which did not work. Alpha Five "may" be easy, but xbasic certainly is not.

    Thank you.

    Leave a comment:


  • Stan Mathews
    replied
    Re: Adding records with code

    More like?
    <TBL>.FETCH_LOC_NEXT( Matching_Expression as C [, Fieldname as C ] )

    Watch out when you see [, Fieldname as C ]. It generally means the field name should be quoted (to distinguish it from the value contained in the field or a variable with the same name).

    Give it a try as

    tblOrder.fetch_loc_next(vDate,"Order_Fri")

    Actually you will be better served to check out .fetch_find() and indexes. Also, it is often recommended that when you have a new question, start a new thread. Makes the posts here more on topic to the original thread heading.

    Leave a comment:


  • garland_owl_1966
    replied
    Re: Adding records with code

    I have managed to add records with code, but how do you look up a record. I have a table that contains a date field. The date is the date of Friday for that week. I have the following script:

    dim vSat as d
    dim vFri as d
    dim vYear as n
    dim vWeek as c
    dim vSeq as n
    dim vWk as n
    dim vOrderno as c
    dim vDate as d
    'ok_enabled=.f.
    vDate = date()
    While dow(vDate) <> 6
    vDate = vDate + 1
    end while
    ui_msg_box("vDate",vDate) ' This shows that I have reached the correct date.
    dim tblOrder as p

    tblOrder = table.open("Orderno")
    tblOrder.fetch_first()


    ui_msg_box("Friday Date",tblOrder.order_fri)


    tblOrder.fetch_loc_next(vDate,tblOrder.Order_Fri) <------This line cause the error message below

    vSat = tblOrder.order_sat
    vFri = tblOrder.order_fri
    vYear = tblOrder.order_year
    vWeek = tblOrder.order_week
    vWk = val(tblOrder.order_week)
    vSeq = tblOrder.order_seq + 1

    vOrderno = alltrim(str(vYear))+" "+alltrim(vWeek)+" "+alltrim(str(vSeq))


    **** Error Message ******
    tblOrder.fetch_loc_next(vDate,tblOrder.Order_Fri)
    The number of arguments or the type of one or more arguments do not match any existing function.


    My functions book shows the following:

    <tbl>.fetch_loc_next(value,fieldname)

    Objective on 02-28-2013 was to find the record in the Orderno table that contains the Order_Fri field that is equal to 03-01-2013.

    I have spent over a week beating my head against the wall with this very basic task.
    Thank you to anyone who can point me in the right direction.

    Leave a comment:


  • Clunes
    replied
    Re: Adding records with code

    This video is a brief explanation on how to quickly learn xbasic using the power of the genies built into Alpha. I learnt a great deal in the early days by understanding the action script first and then converting to xbasic
    Click here - Adding a new record using xbasic genie
    Last edited by Clunes; 02-17-2013, 01:29 AM.

    Leave a comment:


  • garland_owl_1966
    replied
    Re: Adding records with code

    I forgot that I had a pdf of "Xbasic for Everyone" that went through Alpha Five v8. I was able to solve my problem. Thank you to all who replied.

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Adding records with code

    Shelley, this message board can serve as a sort of knowledgebase if we limit each thread of messages to a single topic or question. Otherwise a single thread turns into a blog as the original poster builds his or her application, encountering and overcoming one problem after another. Anyone searching the board for help on a particular issue might find the blog, but then have to wade through all the posts just to find the item of interest. See what I mean?

    Concerning your second question, you might tell us specifically how you're doing it now.

    Also, you should probably look into purchasing Dr. Wayne's good book "Xbasic for Everyone" from Alpha.

    The help system includes a series of tutorials. You should read through the following:

    Getting Started (Desktop)
    Alpha Five User Guide (Desktop)
    Learning Xbasic

    You will find much that is familiar. Many of us have dBase or FoxPro backgrounds.

    Finally, welcome to the message board!

    -- tom

    Leave a comment:


  • Al Buchholz
    replied
    Re: Adding records with code

    Shelley

    When driving a boat, don't steer like it's a car....

    Look at the object explorer to see the object names on a form/browse that you can use in your code.

    Leave a comment:


  • garland_owl_1966
    replied
    Re: Adding records with code

    Thank you. Now if I can figure out how to copy field values to variables so that I can increment and add an updated record. I use a field called orderno. It consists of a 2-digit week number, a dash, and a 4-digit number, the first digit of which is for the current year. This week contained the 7th Friday of the year, so the first orderno of the week was 07-3001. Next Monday, we'll start week 8, hence 08-3001. I know what fields I need, but not how to manipulate in code. Thanks in advance.
    Last edited by garland_owl_1966; 02-15-2013, 11:43 PM.

    Leave a comment:


  • garland_owl_1966
    replied
    Re: Adding records with code

    Originally posted by Stan Mathews View Post
    Just begin a new record, assign the variables to fields, end the begin.

    tbl = table.open("sometablename")
    tbl.enter_begin()
    tbl.fieldname1 = "something" 'or could be a variable name
    tbl.fieldname2 = "something else" 'or could be a variable name
    tbl.enter_end(.T.)
    tbl.close()

    Leave a comment:


  • Stan Mathews
    replied
    Re: Adding records with code

    Just begin a new record, assign the variables to fields, end the begin.

    tbl = table.open("sometablename")
    tbl.enter_begin()
    tbl.fieldname1 = "something" 'or could be a variable name
    tbl.fieldname2 = "something else" 'or could be a variable name
    tbl.enter_end(.T.)
    tbl.close()

    Leave a comment:


  • garland_owl_1966
    started a topic Adding records with code

    Adding records with code

    In d-base, I use a table, append blank, and then replace the value in the fields with the value in variables, then move off the record. How do you do that in Alpha Five v11? I have searched everything that I can think of, but cannot find the answer. Thank you in advance.
Working...
X