Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Req to update single parent field on Form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Req to update single parent field on Form

    Hi there,

    I have a Form consisting of Parent and Embedded browse into which I enter Items

    On each Item added I use 'parentform.resynch()' and all the required fields update correctly.

    If I amend an item However, 'parentform.resynch() plays havoc with my embedded browse layout going back to first item of embedded browse, rather than staying on the line being amended, which is what I and my users want.

    How do I refresh a single field on the form such as Td_head.Netamt. in my attachments ? As you can see I have tried a few unsuccessfully.

    Code:
    xbasic_wait_for_idle()							'doesn't like 'head_netamt = tablesum(s_item,xact_filter,"netamt")'
    												'..below - may this will help (Stan Matthews implied timing issue)
    s_xact_id  = Td_head.xf_xctidf					'needs to be shared or global ??
    xact_filter = "Xm_xctidf = Var->s_xact_id"		'Works
    xbasic_wait_for_idle()							'doesn't like 'head_netamt = tablesum(s_item,xact_filter,"netamt")'??
    head_netamt = tablesum(s_item,xact_filter,"netamt")
    xbasic_wait_for_idle()							'doesn't like 'head_netamt = tablesum(s_item,xact_filter,"netamt")'??
    head_vatamt = tablesum(s_item,xact_filter,"Vatamt")
    
    s_net_amnt = head_netamt						'req for button 'btn_Commit_Xsact'
    s_vat_dsc_amnt = head_vatamt					'req for button 'btn_Commit_Xsact'
    
    Td_head.change_begin() 
    	Td_head.Netamt = head_netamt
    	Td_head.Acumitmvat = head_vatamt
    	Td_head.Dueamt = head_netamt + head_vatamt
    Td_head.change_end()  
    
    'parentform.resynch()							'this NIEKS the embedded browse badly - beware present elsewhere
    'sys_send_keys("{F5}")							'also plays havoc with the embedded browse
    'head_netamt.resynch()
    'resynch(head_netamt)
    'Td_head.Netamt.refresh()						'no can do
    
    goto finish										'----->>>>>
    'end
    Attached Files
    Dave Mac

    It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

    #2
    Re: Req to update single parent field on Form

    sop_head_job->Netamt is a field object on your form sop_Xact_Wtk_m (or something like that)
    But you appear to be changing its value in the underlying table.
    Have you opened the table "sop_head_job" with the pointer Td_head or getting a pointer to the form's table?

    Either way - that's a topic for another discussion.
    The easiest may be for you to use calculated field on the form while working on it. Its instant and automatic, no resynch or refresh required, it triggers on row change.

    Comment


      #3
      Re: Req to update single parent field on Form

      Originally posted by Ray in Capetown View Post
      The easiest may be for you to use calculated field on the form while working on it.
      Hi Ray in Capetown,

      Thanks for the input. Had to adjust my thinking a bit, but it works well.

      I ideally require to use the calculated result 'calc_netamt' in the XBasic code into a field in the underlying table. Is there any way that I can address this calculated result, rather than have to track it in my XBasic, which is what i am presently doing ?

      Hope that this is clear enough for you.

      Looking forward
      Dave Mac

      It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

      Comment


        #4
        Re: Req to update single parent field on Form

        Example?
        You can address the calculated field as type calc

        Comment


          #5
          Re: Req to update single parent field on Form

          Hi ray,

          Am attaching a screen dump of my calculated field cal_head_netamt.

          I need to address this calc value in my XBasic rather than tracking into local numeric variable head_netamt

          Code:
          FUNCTION Sop_Xct_item_OnSave AS V ( )
          
          dim Td_head				 	as p				'pointer to Sop Head
          dim Td_itm					as p				'pointer to Sop Items
          dim Td_debt					as p
          
          dim global gspw_op_typ_sel  as c				'Work Tickets
          dim global gspi_op_typ_sel  as c				'Invoices
          dim shared s_head			as c				'Must load s_head file name in Form
          dim shared s_item			as c				'Must load s_item file name in Form
          dim shared s_acc			as c				'Must load s_acc file name in Form
          dim shared s_vat_rate		as n				'Must load s_vat_rate file name in Form
          dim shared s_vat_code		as n				'Must load s_vat_code file name in Form
          dim shared s_xact_id		as n				'facilitates net and vat calc
          dim shared s_sop_clr		as l				'req disciplined exit
          dim shared s_esc_curr_itm 	as l				're-init 'curr item cancel' flag
          												'..till set Prod field OnWrote = .t.
          dim shared s_esc_items		as l
          dim shared s_form_title		as c				'Must load s-form_title name in Form
          
          dim row_no		 			as n
          dim tab_lab					as c				'Common Table label (on error goto 0)
          dim s_s_curr_item			as n				'Current embedded browse line_No. register
          dim xact_filter				as c				'to facilitate tablesum
          dim head_netamt				as n
          dim head_vatamt				as n
          
          head_netamt = 0									'init
          head_vatamt = 0									'init
          
          Td_itm.fetch_first()
          while .not. Td_itm.fetch_eof() 
          	row_no = row_no + 1
          	s_vat_rate = Td_itm.vatrate 						'in case vat calculation not invoked in item enter
          	item_vat_amnt = Td_itm.netamt * (s_vat_rate * 0.01)	'vat amount	
          
          	Td_itm.change_begin() 
          		Td_itm.lne_no = int(row_no)
          		Td_itm.xm_accidf = Td_debt.acc_id		'debt Account Id
          		Td_itm.itmact = .t.						'item active
          		Td_itm.prdgrp = 1						'tsr will always be
          		Td_itm.whcde = 1						'tsr will always be
          		Td_itm.salesrep = Td_debt.salesrep 
          		Td_itm.Terr = Td_debt.Territory
          		Td_itm.custclass = Td_debt.cust_class
          		Td_itm.xctdte = Td_head.xf_xctdtef 		'Xact date
          		Td_itm.ordno = Td_head.ordno			'Order no				 		
          		Td_itm.vatcde = s_vat_code				'plugged in script 'vat_code_and_rate'
          		Td_itm.vatamt = item_vat_amnt
          	Td_itm.change_end()
          
          	head_netamt = head_netamt + td_itm.netamt	'add item netamt to head netamt
          	head_vatamt = head_vatamt + td_itm.vatamt	'add item vatamt to head vatamt
          	
          	Td_itm.fetch_next()
          end while
          
          Td_head.change_begin() 
          '	Td_head.Netamt = calc->cal_head_netamt	'indicating where calculated value needs to be
          	Td_head.Netamt = head_netamt
          	Td_head.Acumitmvat = head_vatamt
          	Td_head.Dueamt = Td_head.Netamt + Td_head.Acumitmvat
          Td_head.change_end()  
          
          finish:
          
          END FUNCTION
          As you can see the above cal_head_netamt needs to be addressed

          Looking forward.
          Attached Files
          Dave Mac

          It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

          Comment


            #6
            Re: Req to update single parent field on Form

            Yes I see your screendump showing the calculated fields.
            Doesn't that show your item totals?
            What is the question now with all this code posted?
            to address the calc value on the form use topparent:cal_head_netamt

            Comment


              #7
              Re: Req to update single parent field on Form

              Hi Ray,

              Appreciate your persistence.

              Yes, the calculated field does indeed show item totals.

              I have truncated the code to show only my problem code.

              Code:
              dim head_netamt				as n
              
              head_netamt = 0									'init
              
              Td_head.change_begin() 
              	Td_head.Netamt = [COLOR="#FF0000"]head_netamt[/COLOR]
              	Td_head.Acumitmvat = head_vatamt
              	Td_head.Dueamt = Td_head.Netamt + Td_head.Acumitmvat
              Td_head.change_end()  
              
              '	This code above works 
              '	I require to replace the code line 
              '
              	Td_head.Netamt = [COLOR="#FF0000"]head_netamt[/COLOR]
              	
              
              '	with ......
              
              
              	Td_head.Netamt = [COLOR="#FF0000"]cal_head_netamt[/COLOR]		'the calculated value
              	
              '
              '	it does not like my calculated field   [COLOR="#FF0000"]cal_head_netamt[/COLOR]
              '	How do I get XBasic to address this calculated field ?
              '
              I can't see in XBasic any facility to address calculated values. Am I missing something ?
              Dave Mac

              It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

              Comment


                #8
                Re: Req to update single parent field on Form

                Jislaaik this tuned me grief Ekse - (transl. I say, Gosh this gave me some trouble)
                It shouldn't have, but the syntax is very specific.

                As discussed prev, Calc fields are form based,
                You are changing data at table level in your code. Using variables will work (as you do now) as they are not bound to the form
                It is discourage to mix, if the form later updates the table or whatever the result could be unpredictable.
                Place the field/s from the table on the form (even if not visible) and use this code

                parentform:subtotal.value = parentform:inv_item_totaln.value

                Where subtotal object points to a table field
                and inv_item_totaln object is the forms calculated field

                or create MORE variables for the calc fields.
                Last edited by Ray in Capetown; 11-30-2011, 07:35 AM. Reason: more vars

                Comment


                  #9
                  Re: Req to update single parent field on Form

                  Hi, Dave,

                  I"m not sure what "need to address my calculated values" might mean, but you're right. Xbasic does not permit you to overwrite a form level calculated display value. The user can't change one from the keyboard either, of course. -- tom

                  Comment


                    #10
                    Re: Req to update single parent field on Form

                    Tom I believe Dave wants to know how to get his calculated field values into the equivalent fields in the table.
                    He has previously been manually calculating all the transaction and other form values, in Xbasic, after or when submitting the form.
                    But he wanted a way to show the calcs on the form where I suggested Calc fields and later into the table.
                    I found a safe way for that to work at table level. What do you think?

                    Comment


                      #11
                      Re: Req to update single parent field on Form

                      Thanks Ray,

                      I would have been battling here until the late hours if you hadn't given me the parentform pointer. On we go again.
                      Dave Mac

                      It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

                      Comment


                        #12
                        Re: Req to update single parent field on Form

                        Originally posted by Tom Cone Jr View Post
                        Hi, Dave,

                        I"m not sure what "need to address my calculated values" might mean, -- tom
                        Hi Tom,

                        As Ray explained I needed to get hold of the value of my calculated fields". Is there a more accepted terminology amongst the Alphaholics than address the value

                        Cheers
                        Dave Mac

                        It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

                        Comment


                          #13
                          Re: Req to update single parent field on Form

                          Hello, Dave,

                          The term "calculated field" is, itself ambiguous. You know what you're talking about but for the rest of us we must guess whether you're referencing:

                          1) a table field for which a calc field rule has been defined; or

                          2) a calc display value you've defined in your form layout; or

                          3) a global calc value you've defined as part of the table structure.

                          Once that's resolved, you should know that on this side of the pond when we "address" someone we speak "to" them. So when you say you want to "address" a calc field it seems to these ears that you're want to assign a value to the calc field, which you can't do. I'd use terms like "get" or "retrieve" or "capture" if I were trying obtain the current calc field value.

                          BTW, in many areas (expressions and scripts) you can "get" the value stored in the calc display value by prefixing it's name with "CALC->" If that hasn't been mentioned in this thread thus far, perhaps this would simplify things for you a bit.

                          -- tom

                          Comment


                            #14
                            Re: Req to update single parent field on Form

                            Sure Dave,
                            I met this hurdle a week or two ago in my own dev,. I would have had to work it out sooner or later. You made it sooner.
                            That's why I knew what you meant cos its not obvious.
                            Probably to be clearer "How to Address a calculated field object on a form" otherwise "Obtain a calculated field value on a form"
                            --"need to address my calculated values" sounds like you want some sort of control over them combined with "How do I refresh a single field on the form such as Td_head.Netamt" I almost skipped over that post.

                            Bad timing Tom
                            Last edited by Ray in Capetown; 11-30-2011, 10:47 AM. Reason: My bad timing tom

                            Comment


                              #15
                              Re: Req to update single parent field on Form

                              Hi Guys,

                              Thanks for the clarity. I'll pin this up on the board for future ref to make things easier on your side and mine in future - ("going forward" seems to be more in vogue these days - "in future" - not cool enough)

                              Tom, Your "CALC->" has not been mentioned in this thread. I seem to remember trying it - and it giving me a bit of a run-around- I'll revisit it and see what happens.

                              Dave
                              Dave Mac

                              It's not so much what you don't know that gets you into trouble, but what you know for sure, that just ain't so. - Mark Twain.

                              Comment

                              Working...
                              X