Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code - How do I clean the displayed data from a browse? 1

Status
Not open for further replies.

emaduddeen

Programmer
Mar 22, 2007
184
US
Hi Everyone,

I have a form that contains a browse called SalesDetailsList that is showing data in it. Inside an "Accepted" embed on an entry control is an
Erase (?Address, ?SalesDetailsList) statement.

Everything gets erased except the browse. I also tried Erase (?SalesDetailsList), but it did not work so I am assuming to erase it another command is needed. Can you tell me what that code would be?

Thanks.
Emad
 
Hi Emad,

A Browse displays from a Queue and so to erase a browse, you need to FREE the queue and DISPLAY the list control. This however is not a good idea if the browse is template driven as the queue may be populated again. So the simple solution would be to set a filter which will always return false i.e.

BRWn.SetFilter('1=0','9Z')
BRWn.ResetSort(True)

Regards
 
Hi Shankarj,

Thanks for the code.

I will try it.

Truly.
Emad
 
Hi ShankarJ,

It works great, but I don't know how to get the form back into add mode and increment my auto inc value.

I hope you have some extra time to look at this code so you can tell me what I did wrong or what is missing.

The code is in the "Accepted" embed of the TranHed:paymentAmount control.

Truly,
Emad

Code:
! Set everything up so another transaction can be added.
!-------------------------------------------------------
If TranHed:PaymentAmount = TranHed:SalesAmount |
Then
   ! Click on the Save and Print button.
   !------------------------------------

   Select (?SaveAndPrint)

   PressKey (EnterKey)

   Erase

   ! Erase the data in the browse.
   !------------------------------
   SalesItemsList.SetFilter('1=0','9Z')
   SalesItemsList.ResetSort(True)

   ! Display the screen to select a customer.
   !-----------------------------------------
   GlobalRequest = SelectRecord

   ! Disable these.
   !---------------
   Toolbar11.SetEnabled (ID11_btnInsert, False)
   Toolbar11.SetEnabled (ID11_btnChange, False)
   Toolbar11.SetEnabled (ID11_btnDelete, False)

   ! Set defaults.
   !--------------
   TranHed:TransactionType = 'Sale'
   TranHed:PaymentType = ''

   Display()

   SelectCustomer

   ! Tell the form to go into insert mode.
   !--------------------------------------
   GlobalRequest = InsertRecord

   Access:TransactionHeader.PrimeAutoInc

   Display()

   ! Set the browse so it can take additional data.
   !-----------------------------------------------
   SalesItemsList.SetFilter('')
   SalesItemsList.ResetSort(True)

   If GlobalResponse = RequestCompleted |
   Then
      ! Populate Point of Sale screen header information.
      !--------------------------------------------------
      TranHed:DateOfSale = today()
      TranHed:TimeOfSale = clock()

      LOC:CustomerName = Clip (CUS:Forename) & ' ' & CUS:Surname
      LOC:CityStatePostcode = Clip (CUS:City) & ', ' & Clip (CUS:StateProvence) & ' ' & CUS:Postcode
      LOC:AlternateCityStatePostcode = Clip (CUS:AlternateCity) & ', ' & Clip (CUS:AlternateStateProvence) & ' ' & CUS:AlternatePostcode
      TranHed:CustNumber = CUS:CustNumber

      If CUS:AlternateAddressLine1 <> '' |
      Then
         LOC:ShippingAddressLabel = ' Shipping Address '
      Else
         LOC:ShippingAddressLabel = ''
      End

      ! Enable these.
      !---------------
      Toolbar11.SetEnabled (ID11_btnInsert, True)

      ?Insert {PROP:Disable} = False

      ! Click on the Insert button.
      !----------------------------
      Post (EVENT:Accepted, ?Insert)
   Else
      ! The user canceled the search customer window.
      !----------------------------------------------
      If TranHed:CustNumber = '' |
      Then
        ! Make sure the user can't do anything until a customer is chosen.
        !-----------------------------------------------------------------
        ?SalesItemsList {PROP:Disable} = True
        ?TranHed:PaymentType {PROP:Disable} = True
        ?TranHed:PaymentAmount {PROP:Disable} = True
        ?CancelOrder {PROP:Disable} = True
        ?SaveAndPrint {PROP:Disable} = True
      End
   End

   Display()
End
 
Hi Emad,

You forget the 9Z bit. It was added to give top priority to the filter.

BRWn.SetFilter('','9Z')
BRWn.ResetSort(True)

should work fine.

Regards
 
Hi ShankarJ,

Your code works perfectly.

Do you know how to get the auto inc value increased and to get the form back into add mode?

Thanks.
Emad
 
Hi Emad,

Looks like you are doing a PrimeAutoInc but it is not working. If what you are trying to achieve is a FORM to remain in Insert mode until cancelled, it can simply be achieved by setting the following template prompt :

Form's Procedure Properties -> Messages & Titles -> After successful Insert

or by the following code :

ThisWindow.InsertAction = Insert:Batch
or
ThisWindow.InsertAction = Insert:Query

Look up InsertAction in the help.

Regards
 
Hi ShankarJ,

I chose your suggestion on "Form's Procedure Properties -> Messages & Titles -> After successful Insert"

I still have a problems because the browse still will not allow inserting after the filter and resorts so I will open up a new thread regarding this subject including code.

Thanks for helping.

Truly,
Emad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top