Alpha Video Training
Page 2 of 2 FirstFirst 12
Results 31 to 42 of 42

Thread: How do you open Sub- UDF from parent UDF

  1. #31
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default Re: How do you open Sub- UDF from parent UDF

    G, I do not disagree.

    John was using the msg boxes only during testing. His design called for the use of xdialogs to display info to the user and collect additional input required to complete the calc. He encountered the same endless loop there.

    He and I have talked about alternatives that might give him better control and more flexibility. His idea of using a simple calc display field and do data entry using the embedded browse is not working. Turns out his calculation depends on a wide variety of factors and can be pretty complicated. I've recommended entering the rows one at a time using a separate form based only on the child table.

  2. #32
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: How do you open Sub- UDF from parent UDF

    G,

    Both of the Mg_box(), If case and Else case. It runs endless, over and over, from start to end of record again.

    Here the ZipFile

    Estimate.zipEstimate.zip

  3. #33
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: How do you open Sub- UDF from parent UDF

    John:
    I will take a look at this later when I have a little more time.

  4. #34
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default Re: How do you open Sub- UDF from parent UDF

    G,

    The general problem is this. Can a calc display field (defined in form) call a UDF that sometimes needs user input through the keyboard to perform its calculations, when that field is being displayed in an embedded browse on a set based form?

  5. #35
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: How do you open Sub- UDF from parent UDF

    Quote Originally Posted by Tom Cone Jr View Post
    G,

    The general problem is this. Can a calc display field (defined in form) call a UDF that sometimes needs user input through the keyboard to perform its calculations
    If the question ended here, the answer is yes.

    Quote Originally Posted by Tom Cone Jr View Post
    G,

    The general problem is this. Can a calc display field (defined in form) call a UDF that sometimes needs user input through the keyboard to perform its calculations, when that field is being displayed in an embedded browse on a set based form?
    My inclination is to say no pending further testing.

  6. #36
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: How do you open Sub- UDF from parent UDF

    Tom:
    I admire how you put the question so succinctly. Sometimes the lawyer in you comes out!
    My inclination was correct. The answer is no.
    Just tested it. It is a struggle just to get that calc value field in the browse and yes, it will go in endless loop. it is, I am assuming, running through all records in the child table. I have to run.. I have an alaram bell going off. later...

  7. #37
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: How do you open Sub- UDF from parent UDF

    Tom and G.

    Thank you for your effort on my problem.

    I still have the trouble using my UDF on a Form which one table.

    I started over from scratch. I created an xDialog and inserted that UDF at end of xDialog. It runs well and manipulated much better than Form base. I could not figured this small problem out. The Problem is that vEstQty did not share or transferred from Main_xDialog to Convert_xDailog. I expected this vEstQty suppose be transfer to the other UDF.

    I called "Dim Shared vEstQty as N"
    Code:
             'This is Main_xDialog  
              'void full scripts, shown only portion
    
             if a_dlg_button = "vPrdid_changed" then
    		    'Run UDF to calculate the POqty
    		   ' dim x as p
    		   ' x = local_variables()
    		   ' vPoQty = Old_EstPoqty_calc(x) '(vPrdId,vEstQty,vEstUom)
    		    
    		    vPoQty = Old_EstPoqty_calc(vPrdId,vEstQty,vEstUom)
            end If
    Code:
            'This is Convert_xDialog  
              'void full scripts, shown only portion
            FUNCTION Old_EstPoqty_calc AS N (vPrdId AS C,vEstQty as n,vEstUom as c)
               'Same as others ...
              'Coverage xDlg
    	vCover_result = ui_dlg_box(dlg_title,<<%dlg%
    	{on_key=enter}
    	{lf};
    	{region}
    	Current Product is:| [%R%.35vSeriesName];
    	Convert Ruler Type:| [%r%.15vRuler];
    	Estimated Quantity:| [%Z%.20vEstQty!vSize_*];
             'void to show
    
            end function
    EstQty.jpg

  8. #38
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: How do you open Sub- UDF from parent UDF

    Never mind, It works well after re-open the A5.
    Thank you

  9. #39
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: How do you open Sub- UDF from parent UDF

    Quote Originally Posted by Tom Cone Jr View Post
    John,
    In your function you run a query and then retrieve a field value from the "found" record. That "found" field value is then used in your IF.. ELSE..END IF code block.
    This will not work because the script in your function DOES NOT WAIT for the query to be completed before executing (or attempting to execute) the statements which follow. Instead, the query is run in a separate thread, and the script continues to run without stopping until the query has finished. In your script that means the variable vMbrType has no value... indeed it doesn't even exist... when the IF..ELSE..END IF code block begins.
    -- tom
    Seriously Tom
    Does this mean as it appears to, that using these two statements;
    - qSer = tSer.query_create()
    - rSer = tSer.Records_get()
    a result will not or might not be assigned to rSer because the .query.create() runs in its own thread and the second statement will execute in the meantime?
    Or am I misinterpreting?

  10. #40
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default Re: How do you open Sub- UDF from parent UDF

    Ray, that has not been my experience. rSer will get a value, but only after the query has run. However, I have seen cases where LATER statements were executed before the query completes. This is most often encountered when users build scripts that run one batch operation after another, expecting the script to wait until all previous opns have finished. That's not the case here, obviously, so perhaps I misspoke. Still, it's something I've learned to check.

    I do not think John was having a timing issue in his script. Instead, I think his problem stems from the interaction of his message boxes and the calc display sequences in his form.

  11. #41
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: How do you open Sub- UDF from parent UDF

    I get you
    I shall take it as a heads up for one other option to check for when something's not appearing to work reliably.

    This post turned out to be quite enlightening for me all round.

    Thanks all concerned.

  12. #42
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: How do you open Sub- UDF from parent UDF

    G,

    x=local_variables()
    vConvQty=Est_Indirect_poqty(x)'
    Can you tell me more about the "Local_variable" application?

    I read about the Local_variable from help files. However, I still not have any Idea to apply it.

Similar Threads

  1. UDF help sys
    By DaveM in forum Alpha Five Version 10 - Desktop Applications
    Replies: 4
    Last Post: 05-21-2010, 11:29 AM
  2. Help with UDF
    By draxx in forum Alpha Five Version 5
    Replies: 6
    Last Post: 01-31-2010, 04:40 PM
  3. UDF triggering twice
    By Dave Booth in forum Alpha Five Version 10 - Desktop Applications
    Replies: 7
    Last Post: 11-23-2009, 12:40 PM
  4. UDF for v7
    By DaveM in forum Code Archive
    Replies: 0
    Last Post: 09-17-2009, 10:38 AM
  5. UDF Variables
    By davej in forum Code Archive
    Replies: 5
    Last Post: 02-12-2005, 01:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •