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

Wizard setup - multiple forms

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

  • enstorms
    replied
    Re: Wizard setup - multiple forms

    John,
    As I understand the fetch_find(), it fetches the first record that meets the condition of the value based on the index, which I am interpreting as really not needing the fetch_first() command. I am assuming you only want to search through the child records of the parent. If this is the case, you can use:
    while .not. tpoItm.fetch_eof() .and. tpoItm.Po_id = s_quote(vPoId)
    But I could be mis-interpreting your intentions.

    My second question - my mistake for not reading fully through "OpenPickup".

    Leave a comment:


  • johnkoh
    replied
    Re: Wizard setup - multiple forms

    Ernie,
    The first question -- Find child records by A Parent record and move to first record of child table.
    The Sencond Question --- If I do not use this(goto RepeatNext), the If condition will not go to next record. I think I do not have to use neither Label or fetch command with "If ... else ... end If " because it should be end of condition and move to next command by it self.

    Leave a comment:


  • enstorms
    replied
    Re: Wizard setup - multiple forms

    Just a couple of things for now.

    dim vPrdctId as c
    dim vDescr as c
    tpoItm = table.get("po_items")
    tpoItm.fetch_find(vPoId) << Why is this needed if you're getting the first record in next line?
    tpoItm.fetch_first()<<Not sure why previous line is needed.
    Code:
    while .not. tpoItm.fetch_eof()
        	vTestRecord = tpoItm.poitem_id
        	vP
        	'Open and read the Products table and find the OnHand Qty
        	dim tPrdct as p
        	dim rPrdct as n
        	dim vOnHand as n
        	tPrdct = table.open("products")
        	tPrdct.index_primary_put("products_id")
            rPrdct = tPrdct.fetch_find(vPrdctId)
        	   vOnHand = tPrdct.Onhand
        	tPrdct.close()    
        	    if vOnHand>0 then
        	       goto OpenPickup 
        	    else
        	       goto RepeatNext[COLOR="red"]<< Why not just:  tpoItm.fetch_next()[/COLOR]   
    	    end if
        RepeatNext:	    
        tpoItm.fetch_next()    
        end while
    Ernie

    Leave a comment:


  • johnkoh
    replied
    Re: Wizard setup - multiple forms

    Ernie and Peter

    Thank you for this
    The Help states that using the form.view() command, the form must be closed from the calling form or the underlying tables
    I could not figured it(to open 2nd form problem) out until read this forum and see Peter's examples.

    I have the looping(?) problem on following coding which Check current OnHand quantity from my Inventory table. The main function is When I enter the Quantity and products_id on Purchase Order then I want to check current inventory quantity before save it. So I have time to revise the Quantity before save it.

    I want to use this scripts with modification in the Field Rule Events on a Purchase order system but none of field rule events are not working with this script.
    Later on, I found that the problem cause by a Calculated field value (made for table lookup) of Mapped table creates this issue. I think It should not happen. I think before save it (CanWrite or CanSaveRecord event) did not recognize the value of a Description(Calculated field) or Products_id field. The Description is a table lookup linked field and Products_id is the result of the table lookup.


    so I decided to use the Button Events on the Purchase Order form.
    This scripts are missing the 2nd(?) looping. If I choose "No", runs to end of child table's records but selected "yes' then Open and closing the 2nd form (Pickup_main), after Re-open the 1st form, this script stopped here which did not goes to next the child records.

    Question
    (a) How can I apply it to Field Rule events?
    (b) What did I missing for looping on this Button scripts?
    (c) Is it possible shown first form(inactive) and 2nd form(active), on top of 1st form?


    Code:
    '****** Check current Product Inventroy ************
    dim tHdr as p
    dim rHdr as n
    dim vStatus as c
    dim vPoId as c
    vPoId = parentform:Po_id.value
    
        dim tpoItm as p
        dim vPrdctId as c
        dim vDescr as c
        tpoItm = table.get("po_items")
        tpoItm.fetch_find(vPoId)
        tpoItm.fetch_first()
        while .not. tpoItm.fetch_eof()
        	vTestRecord = tpoItm.poitem_id
        	vPrdctId = tpoItm.products_id
        	vDescr = tpoItm.description <=== Calculated field from Mapped table. Table Lookup
    
        	'Open and read the Products table and find the OnHand Qty
        	dim tPrdct as p
        	dim rPrdct as n
        	dim vOnHand as n
        	tPrdct = table.open("products")
        	tPrdct.index_primary_put("products_id")
            rPrdct = tPrdct.fetch_find(vPrdctId)
        	   vOnHand = tPrdct.Onhand
        	tPrdct.close()    
        	    [COLOR="red"][B]if vOnHand>0 then
        	       goto OpenPickup 
        	    else
        	       goto RepeatNext   
    	    end if[/B][/COLOR]
        RepeatNext:	    
        tpoItm.fetch_next()    
        end while
    end if
    end
    OpenPickup:
    vAsk = ui_msg_box("Inventory","Found the Invenotry Do you want to use it? "+vPrdctId+"  "+vOnHand,UI_STOP_SYMBOL+UI_YES_NO)
    if vAsk = Ui_yes_selected then
    	'topparent.Close(.f.) 'It works but I do not want to close it How to open overlay?
    	:Purchase.Hide()
            [COLOR="red"]f=form.view("Pickup_main")
            f.New_Record()
            'Do I need something here??[/COLOR]
            
    else vask = ui_no_selected
       cancel() 
       goto RepeatNext
    end if
    
    end

    Leave a comment:


  • enstorms
    replied
    Re: Wizard setup - multiple forms

    Peter,
    Really appreciate the help. Thanks again.
    Ernie

    Leave a comment:


  • Peter.Greulich
    replied
    Re: Wizard setup - multiple forms

    Originally posted by enstorms View Post
    If I'm not sure about the form closing properly, after closing it, I re-open it to see if a/the next number shows tacked on to the end of the form name or it's the same number/no number at end of form name.
    That's a way to check it too.

    Leave a comment:


  • enstorms
    replied
    Re: Wizard setup - multiple forms

    Peter,
    That won't work with dialogs erroneously not closed, because they are invisible and hence no tabs.

    If I'm not sure about the form closing properly, after closing it, I re-open it to see if a/the next number shows tacked on to the end of the form name or it's the same number/no number at end of form name.

    Leave a comment:


  • Peter.Greulich
    replied
    Re: Wizard setup - multiple forms

    Works perfectly!!!!!!!! Could you explain how this code works:

    OPEN_DIALOG: is a label & GOTO loops the code back to the label. So you you have an endless loop until the var is set to "Close", in which case the script encounters the "end" statement. The thing you need to know is that form.load method pauses script execution at the .show() command. Then when you close the form, in this case by parentform.close(), it executes the next line of code in the originating script, which in this case is f.close(). The parentform.close() merely hides the dialog and doesn't actually close it, while f.close() closes the dialog form for real.

    Is it necessary to wrap the Select....End Select in it?

    Yes

    P.S. I always watch the tabs at the bottom when opening/closing forms, especially when using "Dialog", to determine if a new instance of a form is opening or just another instance.

    That won't work with dialogs erroneously not closed, because they are invisible and hence no tabs.

    Leave a comment:


  • enstorms
    replied
    Re: Wizard setup - multiple forms

    Peter,
    Works perfectly!!!!!!!! Could you explain how this code works:

    OPEN_DIALOG:

    GOTO OPEN_DIALOG
    Is it necessary to wrap the Select....End Select in it?

    Ernie

    P.S. I always watch the tabs at the bottom when opening/closing forms, especially when using "Dialog", to determine if a new instance of a form is opening or just another instance.

    Leave a comment:


  • Peter.Greulich
    replied
    Re: Wizard setup - multiple forms

    One other note. When working (i.e. coding/developing) with dialogs, check the xbasic explorer/Objects/Windows often to see if you have any duplicate copies of dialogs -

    e.g.
    wiz_company
    wiz_company0
    wiz_company1
    etc

    If you see that, it means your dialogs are not closing properly and you're leaving invisible copies of the form in memory. As long as you follow procedures similar to my code example, it should work.

    Leave a comment:


  • enstorms
    replied
    Re: Wizard setup - multiple forms

    Thanks so much Peter for helping. I'll take a look. Lots of good suggestions.
    Ernie

    Leave a comment:


  • Peter.Greulich
    replied
    Re: Wizard setup - multiple forms

    Originally posted by enstorms View Post
    Is this the way it is designed to work? Does anybody really understand what is going on? Maybe there's just not a way to get multiple forms to work as dialog and also allow flexibility to navigate back and forth until last form is called. I have 12 forms to step through.
    Fear not, Ernie. There is a way. ;) Dialog forms are prickly critters. I like them, but you have to treat them "right", otherwise they bite you! The trick is that you have to call any subsequent dialogs from the main calling form. Dialogs won't close if you try to call one from the other. Also, I have found that dialogs don't like the .hide() method. Anyway check out the attached sample. Notice how I use a global variable to control the action. Check out the quit button code as well. Plus, when using dialogs, you really need to get rid of the "X" in the upper right corner so that the user doesn't usurp control away from your design flow. Hope this helps...
    Attached Files

    Leave a comment:


  • enstorms
    replied
    Re: Wizard setup - multiple forms

    The Help states that using the form.view() command, the form must be closed from the calling form or the underlying tables will not be closed. In debugging code to try to figure out how opening/closing dialog forms works, I see my :wiz_bank_acct.Close() code never fires. When the wiz_bank_acct form closes (or disappears) it is really still opened since the tab is still showing and the debug window doesn't open back up at the line following the :form.view(..... line.

    Code:
    :wiz_company.Hide()
    
    if is_object(":wiz_bank_acct") then
        :wiz_bank_acct.Show()
    else
        :form.view("wiz_bank_acct","Dialog")
        [COLOR="Red"]:wiz_bank_acct.Close()[/COLOR]
    end if
    This is code on the "Back" button of the wiz_bank_acct form. In trying to get the wiz_bank_acct form to close, I've tried referencing it with topparent.close() also.

    Code:
    topparent.Commit()
    
    [COLOR="Red"]:wiz_bank_acct.Close()[/COLOR]
    :wiz_company.Show()
    This code is on the "Quit" button of the wiz_bank_acct form and it works.
    Code:
    :wiz_bank_acct.Close()
    :wiz_company.close()
    :mainmenu.show()
    Is this the way it is designed to work? Does anybody really understand what is going on? Maybe there's just not a way to get multiple forms to work as dialog and also allow flexibility to navigate back and forth until last form is called. I have 12 forms to step through.
    Ernie

    Leave a comment:


  • G Gabriel
    replied
    Re: Wizard setup - multiple forms

    ..stand by..
    will work on it later

    Leave a comment:


  • enstorms
    replied
    Re: Wizard setup - multiple forms

    Here's a very simple app. Open the mainmenu form and press the "Run Setup Wizard" button to Hide() the Main Menu and bring up the first form. On that form, the Next button should take you to the second form and Hide() the first. The second form has a Back button that I am wanting to close the second form and take you back/show() the first form. The Quit button on both forms are supposed to shut down the forms and show() the Main Menu. Hope somebody can see where I'm going wrong in trying to get this working. There may be a better way, but I haven't found it.
    Ernie

    Leave a comment:

Working...
X