Hello everyone. Hope all of you had a good weekend.

Today I had a customer call to request a list of quotes linked to the Customer form. Quotes can be in the form of Shop repairs or Part Orders and any given customer could have both. Since Quotes are not linked to the Customer form, I created a conditional object and added a variable list object which is populated automatically based on CustomerID. I choose this field because it exist in both tables.

Now that is very simple but this post is not about that. From this list object the customer wants to select a Quote in the list then click a button and be immediately taken to the actual quote. Again this would be simple if both Shop and Part Quotes were on the same form, but they are not. So what to do, and the answer is below.

dim SHARED QNum as C
QNum = word(xQTList.value,1,":",1)

if Alltrim(word(xQTList.value,2,":",1)) = "SQuote" then
    DIM Shared varP_ShopQuotes as P
    DIM layout_name as c 
    layout_name = "ShopQuotes"
    DIM tempP as p
    tempP=obj(":"+object_Name_normalize(word(layout_name,1,"@")))
    if is_object(tempP) then 
        if tempP.class() = "form" .or. tempP.class() = "browse" then 
            tempP.activate()
        else
            varP_ShopQuotes = :Form.view(layout_name)
        end if
    else 
        varP_ShopQuotes = :Form.view(layout_name)
    end if 
    
    ShopQuotes.Index_SetExplicit("Shop_Quotes")
    DELETE var_key_target 
    var_key_target = Var->QNum
    
    ShopQuotes.find(var_key_target)
else
DIM Shared varP_PartQuotes as P
DIM layout_name as c 
layout_name = "PartQuotes"
DIM tempP as p
tempP=obj(":"+object_Name_normalize(word(layout_name,1,"@")))
if is_object(tempP) then 
    if tempP.class() = "form" .or. tempP.class() = "browse" then 
        tempP.activate()
    else
        varP_PartQuotes = :Form.view(layout_name)
    end if
else 
    varP_PartQuotes = :Form.view(layout_name)
end if

PartQuotes.Index_SetExplicit("Part_Quotes")
DELETE var_key_target 
var_key_target = Var->QNum
PartQuotes.find(var_key_target)

end if

Our List object is xQTList and I use the word function to set the quote number and as a condition for our if Statement.

if Alltrim(word(xQTList.value,2,”:”,1)) = “SQuote” then

SQuote directs the user to Shop Orders and all other choices directs to Part Orders.

If you look closely at the code you will notice I open the called form then set the index and find the quote using var_key_target. I used this method because this company works in the quote forms constantly and if you use the form load queried the the record is drilled down to just that queried value. My solution takes the user to the requested quote and keeps the primary index in play giving the user greater flexibility.

I hope this presents you with options you can use in your own design.

That’s all for today. If you are a business and need help with an Alpha Software program, contact us. Are rates are reasonable and our work is guaranteed.

Phone:713 417-6831

EMail: NLawson@cdc-takecharge.com