Normal Topic @selectTreeitem() returned Integer question (Read 1472 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
@selectTreeitem() returned Integer question
Aug 18th, 2006 at 9:08pm
Print Post Print Post  
I am trying to understanding the returned integer for @selectTreeitem().

My understanding Is if the command was successful  it returns a 1 if it fails it returns a 0.


For Example

var VDelete as Int

vDelete = @selectTreeitem ("Search Update Menu!Record Commands!Delete Record (F3)")

if the record was deleted Vdelete would be a 1
if the record was NOT deleted Vdelete would be a 0

So if I run the above @selectTreeitem() and when Sesame says “are you sure you yada yada..” and I say

yes, It deletes record and it should return a 1 to Vdelete

If I say No when Sesame asks about deleting It should not delete record and it should return a 0 to Vdelight

When I run the above command a 1 is returned wether or not I select yes or no. The record is deleted or not deleted properly as I select yes or no. This now has me thinking that the 0 or 1 is based on the popup running and getting a response not wether or not the record was deleted.

Please try and correct my mis conceptions.

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @selectTreeitem() returned Integer question
Reply #1 - Aug 18th, 2006 at 9:14pm
Print Post Print Post  
It is simply based on whether the tree item itself was found and could be selected.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @selectTreeitem() returned Integer question
Reply #2 - Aug 18th, 2006 at 9:16pm
Print Post Print Post  
Hello Robert,

The returned integer is True if Sesame was able to find that menu item and run that command. It is False if Sesame could not find that item on the menu tree(ex: looking for something on the Search Menu in Add Data mode, Bad spelling, Bad Path, etc.)

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: @selectTreeitem() returned Integer question
Reply #3 - Aug 18th, 2006 at 9:33pm
Print Post Print Post  
Thanks for the clarification.

Is there a simple technique for knowing if the user decided against deleting?

I have code that is part of a supervisors menu that is used to eliminate a record and it then puts the inventory item associated with it back into the on hand inventory. It works perfectly unless the user answers Sesame question as no do not delete, it stops the record from being deleted but the rest of my code runs that updates the inventory. This causes the inventory to be off.


Below is the section of  code that deals with eliminating an order. I am asking the user if they are sure they want to delete, can I temporarily stop sesame from asking again?

     }
                             }
                             If vDoThing = "Eliminate Record" Then

                             {

                                   // Eliminate Record and return product to inventory


                                         If Itm_PatientFirst <> "" Then

                                   {            
                                         Vname = "for " + Itm_PatientFirst + " " + Itm_PatientLast
     
                                   }
                                         Else
                                   {
                                               Vname = TrakerID
                                   }      

                                         If @askuser("Are you Sure You want this Record " + Vname, "eliminated?","")
                                   {
           
           
                                         vDelete = @selectTreeitem ("Search Update Menu!Record Commands!Delete Record (F3)")

                                         //writeln(vdelete)      //If vdelete = "1" then

                                         XPost(@Fn, Itm_productname, "producttrak!Prod_name","1","Prod_quantityonhand","Add")
                                         @Msgbox("Returning 1 Bottle of" + " " + Itm_ProductName + " to Inventory","","")
                                         throwfocus(Itm_physgroupstate)
                                         
                                   }

                                   Else

                                   {
                                         @Msgbox("No Changes or Deletions Occured","","")
                                         //throwfocus(Itm_physgroupstate)
                                         
                                   }



                             }
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @selectTreeitem() returned Integer question
Reply #4 - Aug 19th, 2006 at 1:09am
Print Post Print Post  
Quote:
Is there a simple technique for knowing if the user decided against deleting?


There is no one foolproof means, but you cann get and keep the count of the records using @ResultSetTotal, and then check if one is missing or not. That might serve until there is only one record left. If that one is deleted, it returns the same number either way.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: @selectTreeitem() returned Integer question
Reply #5 - Aug 19th, 2006 at 5:16pm
Print Post Print Post  
If your records have a unique record ID, maybe you could check the current record ID before and after the call to "Delete Record (F3)", and compare the two results.

That would tell you whether or not the record that was active before this code, is still there when it is done. This should let you know how the user answered the question that F3 generates.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: @selectTreeitem() returned Integer question
Reply #6 - Aug 21st, 2006 at 7:04pm
Print Post Print Post  
You all are awesome! I could not survive without you guys and gals as my safety net.  Smiley

Carl you idea was perfect!

I created a static variable that gets and holds the record id to be eliminated
I then @xlookup using the static variable to a standard variable and then use an if statement to see if my variables do not match before running my update to inventory.

It might not be the correct way but it works like a charm.

Thanks for the help and suggestions.  

                                               
                                   }
                             }
                             If vDoThing = "Eliminate Record" Then

                             {

                                   // Eliminate Record and return product to inventory

                                         vtraker = trakerid
                                         //writeln(vtraker)
                                         If Itm_PatientFirst <> "" Then
                                         

                                   {            
                                         Vname = "for " + Itm_PatientFirst + " " + Itm_PatientLast
     
                                   }
                                         Else
                                   {
                                               Vname = TrakerID
                                               vtraker = trakerid
                                   }      

                                         If @askuser("Are you Sure You want this Record " + Vname, "eliminated?","")
                                   {
           
           
                                         vDelete = @selectTreeitem ("Search Update Menu!Record Commands!Delete Record (F3)")
                                         //Vmatchkey =  @XLookup(@fn, trakerID, "medstrak!trakerID", "trakerid")
                                   Vmatchkey =  @XLookup(@fn, vtraker, "medstrak!trakerID", "trakerid")

                                         If Vmatchkey <> Vtraker then
                                         {
                                         XPost(@Fn, Itm_productname, "producttrak!Prod_name","1","Prod_quantityonhand","Add")
                                         @Msgbox("Returning 1 Bottle of" + " " + Itm_ProductName + " to Inventory","","")
                                         throwfocus(Itm_physgroupstate)
                                         }
                                   Else

                                   {
                                         @Msgbox("No Changes or Deletions Occured","","")
                                         //throwfocus(Itm_physgroupstate)
                                         
                                   }

                                         
                                   }

                                   Else

                                   {
                                         @Msgbox("No Changes or Deletions Occured","","")
                                         //throwfocus(Itm_physgroupstate)
                                         
                                   }



                             }
                             

     }



  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: @selectTreeitem() returned Integer question
Reply #7 - Aug 24th, 2006 at 3:53am
Print Post Print Post  
BOBSCOTT wrote on Aug 21st, 2006 at 7:04pm:
Carl you idea was perfect!


Thank you for the feedback.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged