NetTalk Central

Author Topic: How to refresh the form containing a browse when deleting a browse record  (Read 6251 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Hi,
Please see the attached image.
A is a table form
B is a browse included in a tab of the form
C is a column total
D is the same total but in another tab to make some tax calculations
I add a B record with a form, then returning from the form tha D tab is refreshed ok
but when I delete a B record the C total is OK but the D total remains the same
How can I refresh the D total when deleting a B record?
Thanks

PD: The code to calculate the D tab fields is in the embed:
Routines/Tab/Tab/3 Refresh Routine/End


[attachment deleted by admin]
« Last Edit: April 29, 2013, 03:02:37 AM by michelis »
-----------
Regards
Alberto

Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Any Idea?

Besides... is there any way of using a timer in a form to refresh it?
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
I need an example to give you an answer. There are too many specific details to give you a general answer.

Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
ok, here it goes
I´ve twiked the web31 example adding a tab to the UpdateItems Form to calculate some taxes to the invoice and a new total from the invoice items total.
I´ve added this code to the Setup embed

-Where to put this code?

-How to refresh this values when I add, change or delete an Item

Regards

[attachment deleted by admin]
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
no dictionary included - so I can't open the app.

Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
it is your web31 example, thats why I did not include it to save space

[attachment deleted by admin]
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
you must _always_ include the dictionary. You do not need to worry about saving space.

the dict shipped in the examples was converted by your Clarion 8 - and your copy is now unique to match your app. I cannot recreate the same dict even from the same source C6 dict.

Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
FWIW here it goes...

[attachment deleted by admin]
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
ok, unfortunately what you're sending me doesn't open here.

I'll try and simplify this for you.

When submitting an example, you must submit the app and dict together. I _have_ to have both of these. If there are data files (like TPS files) it's usually a good idea to include that as well. If you want to send the whole web folder that's fine too.

Unfortunately both your app/dict combination and your whole-web-folder won't open for me here. The tables in the dict are disconnected from the app, so it won't compile.

Please check that the app compiles ok on your side, and if it does repost the app & dict together.

cheers
Bruce



Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
I've open and recomplile the app.
I'm using C8 9759
And the app is opened in C6 mode
It compiles and run ok
attached goes a new zip

[attachment deleted by admin]
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
ok, I figured out the problem. Your app was using a fixed pah to the dict, and I happened to have a dict with that name in that place. I renamed mine so when your app opened it promoted me for the new dict name.

You'll need build 7.11 (coming soon) for this to work.

The code you want to embed is

    loc:SubTotal = InvoiceTotal(p_web.GSV('INV:ID'))
    p_web.SSV('loc:SubTotal',loc:SubTotal)
    p_web.SSV('loc:Tax1', loc:SubTotal*.1)
    p_web.SSV('loc:Tax2', loc:SubTotal*.05)
    p_web.SSV('loc:Total', loc:SubTotal + (loc:SubTotal*.1) + (loc:SubTotal*.05) )

Note that you're setting session values here, as is the usual case when manipulating form fields.

The best embed for it is the top of the Value::loc:SubTotal  routine. So whenever the loc:Subtotal field is displayed it is recalculated.

Note we're using the value routine here, not the validate routine, because these fields are a result of something else changing, they don't change by themselves. I could have used the Validate routine for the Browse Field, but then they would still need to be primed when the form opens. So the Value routine works for both of those.

I've added these 4 total fields to the Client-Side Reset list for the Browse control. Let me say that again. The Browse field on the form. Go to the Client-Side tab, and add the "dependent" fields there in the Reset List - just like you would do for any form field.

(Aside Note: I have to tweak the code in the InvoiceTotal procedure because it had a bug which was exposed when called in this way. But I don't think that's important to this conversation.)

Cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Thanks Bruce!
I do not  have NT7 and I doubt I will have it if economic problems continues in my country.
I´ve tried to refresh this fields with NT6 but it does not work

A question that can be my solution to this.
- Is there any way to "view" the form before detele it?
This way the return from the form willl refresh the fields like when I add or change it

Thanks again
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
yes, if you don't have a delete button on the browse, you can add a delete button to the form
(see layout tab).

So to delete, you click on Change (on the browse) then delete (on the form.)

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1875
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Thanks but pfffffffff

I delet the delete button from the browse.
Maintain the Change button.
Add the delete button to the form but the record is not deleted.

Then , just in case add the delete button to the browse itself
Test again and the record is not deleted.

Anythig else I need to do to make ir work?

-----------
Regards
Alberto