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 2 or more records to a form

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

    adding 2 or more records to a form

    on my main form i have a button "add a hearing aid"
    when the user pushes it asks left,right,both
    i capture that and other info in variables, close the parentform, and open a form for adding hearing aids.

    so far so good

    but here's the rub:
    at the onsave event, i write information to two other files. Then I check the varible (left/right/both)
    and if its both i add another record, filling in several of the fields in advance

    all in all everything works okay - but when they get to one of the "fieldrule lookups" - paytype - on the second record I get the error "incomplete lookup - unable to make the ...

    I may be making this too complicated - how do others handle this sort of situation??
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    [email protected]

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

    #2
    RE: adding 2 or more records to a form

    Martin, it sounds as though you're entering a new record for each hearing aid and that may be exactly what you need. Maybe we can suggest a fix for the lookup error you're getting if you give us more details.

    Your question asks for design suggestions, and I'm often wrong, but never in doubt, so here goes...

    You might consider changing the system to enter one record for each customer, instead of each hearing aid? You could have a field for 'ear' where you store left, right or both. You could have a field (or a series of fields) for the model details are recorded for the 'left' side, and a field or fields where the same info is collected for the other side. During data entry the form could enable and disable the left and right fields based on the value in the ear field. This design would result in lots of empty fields if most customers have only one hearing aid, but I'd argue that maybe the data entry simplicity would be worth the lost disk space...

    -- tom

    Comment


      #3
      RE: adding 2 or more records to a form

      thank's tom - but many users have 3 or more aids - they buy replacements and history is retained for a period of time - so multiple records is the best way to go i think - at any rate, i got the problem to disappear - although I'm not sure how or why. it happened to me once before - what happens is that a field set to be filled in by a lookup, defined in field rules as a simple lookup, works on the first record but bombs on the second - it say unable to create ..... anyway, i wish I knew what I did to fix it.

      although i have a good working model, i have had a time getting the second record to work. when i write the first record, i setup repeat values for the second record and send a Tab to get it to work.
      Cole Custom Programming - Terrell, Texas
      972 524 8714
      [email protected]

      ____________________
      "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

      Comment


        #4
        RE: adding 2 or more records to a form

        Martin,

        Are you using xbasic to write to your forms or to the underlying table(s)? I guess the forms because if you write directly to the table you should not (I think) be dealing with the lookup. When you write to the form using xbasic you get all the advantages and disadvantages of the high level field rules.

        Flesh out your discription a bit, why don't you.

        Bill
        Bill Hanigsberg

        Comment


          #5
          RE: adding 2 or more records to a form

          thank's Bill, following is the code at the OnSave event for the "add a hearing aid form."

          this code is about 1 1/2 years old. I wrote it when I was first learning Alpha/XBasic.

          the way it works is this:
          on the "master form" there is a button "Add a Customer" that at the onsave event for adding the customer asks if you want to add a hearing aid, and if so left/right/both. if they answer both it sets the variable one_or_two to "both", and opens the addahearingaid form in a new record with other variables sent to it, like customer number, etc.

          the last field in the record, salesperson, is a lookup/simple expression field - about every 7 or 8 months it bombs on the second record - i.e, if they are adding two hearing aids

          ''XBasic
          tbl=table.current()
          dim rec as n
          dim tempdate as d
          dim temp as n
          cnum=tbl.customer_number
          uniquesn=tbl.uniquesn
          amount=tbl.sale_amount
          if amount > 0
          count=1
          end if

          tbl=table.current()
          bell=table.open("bell customers")
          bell.index_primary_put("custnmbr")
          bell.fetch_find(cnum)
          de=table.open("dailyentries") ' a logging file archived every 90 days
          de.enter_begin()
          de.filedate=date()
          de.customer_number=cnum
          de.hasale_date=tbl.sale_date
          de.hamdlnmbr=tbl.model_number
          de.hasernmbr=tbl.serial_number
          de.hasaleamnt=tbl.sale_amount
          de.hasalesper=tbl.sales_person
          de.hadateadd=tbl.date_added
          de.fullname=bell.fullname
          de.sales_office=bell.sales_office
          de.type="Hearing Aids Add"
          de.timechanged=dtoc(date()) + " - " + time("0h:0m:0s-AM",now())
          de.enter_end(.t.)
          de.close()
          bell.close()

          tempdate=tbl.sale_date
          pay=table.open("payment history") 'this puts a charge in payments history so that i only have one file to use to get accounts receivable updates
          pay.index_primary_put("custnmbr")
          pay.enter_begin()
          pay.cust_number=cnum
          pay.payment_date=tbl.sale_date
          pay.amount=tbl.sale_amount
          pay.charge_or_payment="Charge"
          pay.description="H-Aid - " + alltrim(tbl.model_number) + " - " + alltrim(tbl.serial_number)
          pay.uniquesn=tbl.uniquesn
          pay.date_added=date()
          pay.timechanged=dtoc(date()) + " - " + time("0h:0m:0s-AM",now())
          pay.enter_end(.t.)
          pay.close()
          if var->one_or_two="Both"
          FacInv = tbl.facinvnmb
          SalePer = tbl.sales_person
          Sorce = tbl.source
          WarLen = tbl.warranty_length
          DelDate = tbl.delivery_date
          ExpDate = tbl.expiration_date
          var->one_or_two="" 'reset variable
          parentform.new_record()
          parentform:ear.value="R"
          parentform:customer_number.value=cnum
          parentform:Facinvnmb.value=facinv
          parentform:Sales_Person.value=saleper
          parentform:Source.value=sorce
          parentform:Warranty_Length.value=warlen
          parentform:Delivery_Date.value=deldate
          parentform:Expiration_Date.value=expdate
          parentform:sale_date.value=tempdate
          sys_send_keys("{tab}")
          end
          end if

          if var->count=1 ' if there was a sale amount greater than 0.0
          choice=ui_get_radio("You Added a Hearing Aid - Enter Intial Payment?",1,"Yes","No")
          if choice="Yes"
          f=form.view("Payments Initial Add")
          f.new_record()
          f:cust_number.value=cnum
          f:Charge_Or_Payment.value="Payment"
          f:Cname.refresh()
          f.maximize()
          parentform.Close()
          end
          else 'if the aid has sale amount but no payment update balance due
          script_play("uponebalance")
          end if
          end if

          phones:
          if adding="Add"
          choice=ui_get_radio("You Added a Customer - Add Phone Numbers?",1,"Yes","No")
          if choice="Yes"
          adding=""
          f=form.view("addaphone")
          f.new_record()
          f:customer_number.value=cnum
          f:cname.refresh()
          f:phone_number.activate()
          parentform.close()
          end
          end if
          end if
          adding=""
          form.view("master form")
          parentform.Close()
          end


          I wonder if I moved the offending last field, saleperson, from last to next to last, that might solve the problem.

          Cole Custom Programming - Terrell, Texas
          972 524 8714
          [email protected]

          ____________________
          "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

          Comment


            #6
            RE: adding 2 or more records to a form

            Martin,

            I'm not sure I followed your logic...for example i don't see where you saved the data you wrote to the addahearingaid form... but your problem might not be the lookup even though it looks like it when you are entering.
            What I would suggest is that the problem might be with the use of "parentform". Since you are doing a lot of opens and closes, i would use the actual form name instead of parentform. Perhaps alpha is geting confused about which form you mean to affect.
            Pat Bremkamp
            MindKicks Consulting

            Comment


              #7
              RE: adding 2 or more records to a form

              i just checked - there is no button on the form to save the record.

              the record saves when it reaches the last field - i guess!!?? - good point - its the only form i don't have a save button on that is the last in the tab order

              in looking at the code with a year and a half on xbasic under my belt, i see a lot of ways i could clean up the script.

              i think a button would be the way to go
              thank's

              there are no other forms - all other files are opened and closed with xbasic.
              Cole Custom Programming - Terrell, Texas
              972 524 8714
              [email protected]

              ____________________
              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

              Comment

              Working...
              X