Alpha Video Training
Results 1 to 7 of 7

Thread: xDialog Box and Set.external_record...

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

    Default xDialog Box and Set.external_record...

    Good Morning Everyone,

    I used the A5's sample Code which is "Creating a Genie Dialog Box". I made the DropDown List box with Keylist Builder which worked well but ...

    I want to have the Dropdown list box which created with "Set.External_record_content_get()" . This code, DropDown List Box was tested and worked fine in the standard scripts.

    I could not figure the location of the my "Dropdown list box code" in place. I switched this code on the several location but I got an error messages or not showed the lists.

    A5 Error message said that "Cannot use function in this context".

    Does any one know where this script should be located or "Set.External_record_content_get()" is not work with it?

    Here is the Shorten of scripts

    Code:
    Function Initial_page as c ()
            'This command creates a pointer to all of the local variables in the script
           page = 1
           max_pages = 3
      ===== I tried on here
           'flag controls if you can move off the current genie page.
           ui_dlg_box("Genie",<<%dlg%
            {startup=init}
            'some code here...
            {endregion}
           %dlg%, <<%code%
           if a_dlg_button = 
                  'some code here...
           %code%)
      ===== I tried on here
    End Function
    
    function define_pages as C (vars as P)
      ===== I tried on here
           with vars
      ===== I tried on here
           page_1 = <<%dlg2%
           ui_modeless_dlg_box("genie",<<%dlg%
           {cellspillover=on}
           Something .....
           %dlg%,<<%code%
                       if a_dlg_button = 
                           'some code here...
      ===== I tried on here
           %code%)
           %dlg2%
           end with
    end function
    Genie Dialog Box Sample.jpg

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: xDialog Box and Set.external_record...

    Is there some portion of the syntax description you find unclear?

    The KEYLIST_BUILD() function returns specially formatted data for display of advanced record lists in an Xdialog form.
    If you can create an equivalent string with set.external...get() then you should be able to substitue it in place of keylist_build().

  3. #3
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,084

    Default Re: xDialog Box and Set.external_record...

    Hi Stan,

    I have this code where the Keylist_builder() and after .... end of the xdialog on 2nd function.

    Here, the code location and an error message.

    Genie_Error Msg.jpg

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: xDialog Box and Set.external_record...

    Yes, I can see the code location and the error message. I can't see the code or tell what you are trying to do.

  5. #5
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,084

    Default Re: xDialog Box and Set.external_record...

    Stan,

    I have attached the full script page A and B.

    Code:
    FUNCTION EstItem_Calculator AS C (vHdrId as c, vEstSection as c )
    
    Dim dlg_title as c ="Calculator"
    
    
    vPage = 1
    vMax_pages = 3
    'flag controls if you can move off the current genie page.
    dim genie_stay as L
    	genie_stay = .f.
    dim error_message as C
    'error message if you try to move off the current page when all
    'conditions have not been met.
    error_message = ""
    
    vlocal = local_variables() 'Call Local variable
    EstItem_define_pages(vlocal) 'UDF
    EstItem_set_flags(vlocal)
    
    'Initial Lists / Conditions
    DIM vEstUom_rl_def as C 
    	vEstUom_rl_def = "k=ctg_uom,{keylist_build(\"H=.05,1:5\",''+Uom_id,left(''+Uom_id,5))}{}"
    'DIM vPrdId_rl_def as C 
    '	vPrdId_rl_def = "k=old_prdcts,{keylist_build(\"H=.05,1:25[]\",''+Prod_id,left(''+Prod_Name+Shape_Id,25))}{}"
    DIM vColorNo_rl_def as C 
    	vColorNo_rl_def = "k=colorseries,{keylist_build(\"H=.05,1:38\",''+Colorseries_id,left(''+alltrim(Colorno)+\" \"+Colorname,38))}{}"
    
    dim vSeriesId as c
    DIM vSeriesId_rl_def as C 
    vSeriesId_rl_def = "k=series,{keylist_build(\"H=.05,1:25[Series Name]\",''+Series_id,left(''+Series_name,25))}{}"
    
    'Initial Lists value
    dim vPrdList as c
    vPrdList = set.external_record_content_get("oldprd_lst.set",\
    "old_get_shape_name(alltrim(Shape_Id))+\" \"+Old_Prdgrp->Finish+\" \"+Old_Prdgrp->Pricegroup+\"^\"+alltrim(Prod_Id)",\
    "Old_Prdgrp->Finish+Old_Prdgrp->Pricegroup","left(Group_id,len(Var->vSeriesId)) = Var->vSeriesId",1)
    
    
    dim vDlgbx as c
    vDlgbx = ui_dlg_box(dlg_title,<<%dlg%
    {startup=init}
    {region0}
    {region1}
    	{image=$$large.generic.key}
    	{wrap=20};
    	{lf};
    	This Genie will calculates 
    	the Purchase QTY, Coverage and Labor Cost.
    	{lf};
    	
    {endregion1}|{sp}|
    {frame=1,1}
    {region3}
    {embedded=70,15genie}
    {endregion3};
    {region}
    {endregion};
    {endregion0};
    {region}
    {justify=right}<15&Cancel> <15<&Previous!previous?flag_previous> <15&Next\>!next?flag_next> <15&Finish?flag_finish>
    {endregion}
    %dlg%, <<%code%
    'Condition
    if a_dlg_button = "init" then
       a_dlg_button = ""
       EstItem_show_page(vlocal,1)
    end if
    
    if a_dlg_button = "next" then
       a_dlg_button = ""
       vpage = vpage + 1
       if vpage > vmax_pages then
           vpage = vpage + 1 'vmax_pages
       end if
      
       EstItem_show_page(vlocal,vpage)
    
    '   Something wrong here, Keybord enter on Next went to on Last page. The mouse click goes to Next page. Why????
    '   if vpage = vmax_pages then
    '       msgbox("Tell me right page "+vPage)
           'Calculate_Rate(vlocal)
    '   end if
    end if
    
    if a_dlg_button = "previous" then
       a_dlg_button = ""
       vpage = vpage - 1
       if vpage < 1 then
           vpage = 1
       end if
       EstItem_show_page(vlocal,vpage)
    end if
    %code%)
    	'It did not work at 4 locations, Top, here and Define Page, top and Insert
    	'if a_dlg_Button = "Series_changed" then
    		
    	'end if	
    		
    if vDlgbx = "&Finish" then
        'ui_msg_box("finish","good")
        play_sound("Windows XP Startup", UI_SYSTEM_SOUND)
        'open the table and save
        tbl = table.get("est_items")
    	tbl.enter_begin()
    		tbl.Esthd_id = vHdrId
    		tbl.ESTQTY = convert_type(vEstQty,"Numeric")
    		tbl.ESTUOM = convert_type(vEstUom,"Character")
    		tbl.PROD_ID = convert_type(vPrdId,"Character")
    		tbl.COLORNO = convert_type(vColorNo,"Character")
    		tbl.Po_Qty = convert_type(vPoQty,"Numeric")
    		tbl.Mtr_cost = convert_type(vPrdPrice,"Numeric")
    		tbl.ADJUST_MTR = convert_type(vAdjcost,"Numeric")
    		tbl.Deduct = convert_type(vDeduct,"Logical")
    		tbl.crewrate = convert_type(vPlnCrewRate,"Numeric")
    		tbl.labor_Production = convert_type(vlbrPrdctn,"Numeric")
    		tbl.ADJUST_LBR = convert_type(vAdjLbr,"Numeric")
    	tbl.enter_end(.t.)
    	parentform.Resynch()
    end if
    END FUNCTION
    Page B
    Code:
    function EstItem_Define_pages as C (vars as P)
    
    with vars
    
    dim vEstQty as n
    dim vEstUom as c
    dim vPoqty as n
    dim vAdjcost as n
    dim vAdjLbr as n
    dim vLbrUnit as n
    'dim Shared vLbrPrdctn as n
    
    vPage_1 = <<%dlg2%
    ui_modeless_dlg_box("genie",<<%dlg%
    {cellspillover=on}
    {lf};
    Enter the following Info;
    {lf};
    {region}
    	Estimated Qty:| [%z%.20vEstQty];
    	UOM:| [%@vEstUom_rl_def%.15vEstUom];
    	
    	{lf};
    {endregion};	
    {lf};
    Press the Next button below to get the Coverage.;
    %dlg%,<<%code%
    1=1
    %code%)
    %dlg2%
    vPage_2 = <<%dlg2%
    ui_modeless_dlg_box("genie",<<%dlg%
    {cellspillover=on}
    Select a Product name:;
    	{lf};
    	{region}
    	Series:| [%@vSeriesId_rl_def%.30vSeriesId!vSeries_changed];
    	Product:| [.20vPrdId^+vPrdList!vPrdId_changed];
    	Color Num:| [%@vColorNo_rl_def%.35vColorNo];
    	{lf};
    	Do you want to see SqFt  (10vDeduct);
    	{lf};	
    	
    	{lf};
    	{endregion};
    Press the Next button below to get the Result.;
    %dlg%,<<%code%
    1=1
    	'Calculate
    	if a_dlg_Button = "Series_changed" then
    		vPrdId =" "  'Clean Previous value
    		vPrdList = set.external_record_content_get("oldprd_lst.set",\
    		"old_get_shape_name(alltrim(Shape_Id))+\" \"+Old_Prdgrp->Finish+\" \"+Old_Prdgrp->Pricegroup+\"^\"+alltrim(Prod_Id)",\
    		"Old_Prdgrp->Finish+Old_Prdgrp->Pricegroup","left(Group_id,len(Var->vSeriesId)) = Var->vSeriesId",1)
    		a_dlg_button =""
    	end if	
    		
    		if a_dlg_button = "vPrdId_changed" then
    			'Calculate the PO Qty
    				vPoQty = Old_EstPoqty_calc(vLocal)
    			   
    			'Calculate the Labor unit cost
    				vLbrUnit = Round((vPlnCrewRate * 8) / vLbrPrdctn ,2)
    		    a_dlg_button=""
    		end if
    %code%)
    %dlg2%
    vPage_3 = <<%dlg2%
    ui_modeless_dlg_box("genie",<<%dlg%
    {cellspillover=on}
    Result:;
    {lf};
    	Purchase Qty:| [%z%.15vPoQty] {text=25,vPackSz};
    	Price from Book:| [%rz%.15vPrdPrice];
    	Adjust Cost:| [%z%.15vAdjcost];
    	{lf};
    	Labor Production:| [%rz%.15vLbrPrdctn];
    	Adjust Production:| [%z%.15vAdjLbr!vAdjLbr_changed] a day;
    	Labor Unit Cost:| [%rz%.15vLbrUnit];
    {lf};
    
    %dlg%,<<%code%
    1=1
    	if a_dlg_button ="vAdjlbr_changed" then
    		 'Calculate the Labor Unit Cost
    		 	vLbrUnit = Round((vPlnCrewRate * 8) / vAdjLbr ,2)
    		a_dlg_button =""
    	end if	
    %code%)
    %dlg2%
    end with
    '{justify=right}<15&Save>
    end function
    Thank you, Stan.

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: xDialog Box and Set.external_record...

    Completely confused. You dim the vPrdList variable and assign it the table.external......get() result in the function EstItem_Calculator. Then you try to refer/use the vPrdList variable in the EstItem_Define_pages function. Since it was defined in the first function as local it is available only to that function.

    If you aren't using it in EstItem_Calculator why not define it in EstItem_Define_pages?

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

    Default Re: xDialog Box and Set.external_record...

    Stan,

    Confusing. -- Me too.

    First, Maybe I am wrong but I have to place the code ( "vPrdList = Set.external.....()") on two locations in order to get Product lists. The one is on top and the other one is located after end of an xdialog. Otherwise, it will not work or I am still miss-understanding about creating the List box yet.

    Code:
    'Test scripts to get the list value
    DIM SHARED vSeriesId as C
    DIM SHARED vProdList as C
    DIM SHARED varC_result as C
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    DIM vSeriesId_rl_def as C 
    vSeriesId_rl_def = "k=series,{keylist_build(\"H=.05,1:25[Series Name]\",''+Series_id,left(''+Series_name,25))}{}"
    vProdList = set.external_record_content_get("oldprd_lst.set",\
    	"old_get_shape_name(alltrim(Shape_Id))+\" \"+Old_Prdgrp->Finish+\" \"+Old_Prdgrp->Pricegroup+\"^\"+alltrim(Prod_Id)",\
    	"Old_Prdgrp->Finish+Old_Prdgrp->Pricegroup","left(Group_id,len(Var->vSeriesId)) = Var->vSeriesId",1)
    
    varC_result = ui_dlg_box("Find Old Product ",<<%dlg%
    {region}
    Series:| [%@vSeriesId_rl_def%.40vSeriesId!Series_changed];
    Product:| [.40vProdId^+vProdList];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    	if a_dlg_button ="Series_changed" then
    	       a_vProdId =""  'Clean Previous
    	       vProdList = set.external_record_content_get("oldprd_lst.set",\
    		"old_get_shape_name(alltrim(Shape_Id))+\" \"+Old_Prdgrp->Finish+\" \"+Old_Prdgrp->Pricegroup+\"^\"+alltrim(Prod_Id)",\
    		"Old_Prdgrp->Finish+Old_Prdgrp->Pricegroup","left(Group_id,len(Var->vSeriesId)) = Var->vSeriesId",1)
    	    a_dlg_button =""
    	end if
    %code%)

    second, I just want to show you what /where I did in the problem scripts. I tried this code on the several locations but were not right place.

Similar Threads

  1. Spell Check on Text Box in Xdialog, RichText xDialog
    By veach in forum Alpha Five Version 10 - Desktop Applications
    Replies: 4
    Last Post: 08-28-2011, 10:19 PM
  2. Set background color of conditionally disable list box in an xdialog
    By Ronald Anusiewicz in forum Alpha Five Version 10 - Desktop Applications
    Replies: 1
    Last Post: 08-28-2011, 11:23 AM
  3. How to invert a character field using XDialog Box with a Record List-Combo Box style
    By Scott Kurimski in forum Alpha Five Version 10 - Desktop Applications
    Replies: 3
    Last Post: 10-28-2010, 04:14 PM
  4. XDialog Box - Set Focus
    By jacklcs22 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 16
    Last Post: 09-21-2009, 12:07 PM
  5. How to set format of field in Xdialog Box?
    By mronck in forum Alpha Five Version 5
    Replies: 2
    Last Post: 03-05-2004, 03:21 AM

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
  •