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

Form refresh, resyc problem with a browse and memo field

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

    Form refresh, resyc problem with a browse and memo field

    I have spent two days trying to get this to work right. All seems to work well once the new record has been added and the form reopened.

    I put together a test database to help simplify my troubleshooting efforts. In the memo script, I blocked where I believe my code is in error.

    Could someone please take a look at this?

    TIA,

    Ron
    Attached Files
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    Re: Form refresh, resyc problem with a browse and memo field

    Originally posted by Ronald Anusiewicz View Post
    ...In the memo script, I blocked where I believe my code is in error.
    Ron
    Ron, I think you are barking up the wrong section of your script. Try going down to line 85 and putting the following in place of what you have there (which is the first line of the following):
    Code:
    'parentform:notes.activate()		'***edit this line
    parentform:notes.Refresh()
    There may be other problems in the script but I think the above will address the major one. In any case, I hope it helps.

    Raymond Lyons

    Comment


      #3
      Re: Form refresh, resyc problem with a browse and memo field

      Ray,

      Thank you for your response.

      I did look at your suggestion, but this did not work.

      After three days of frustration, I decided to stand back and really think about this problem.

      This code was originally written over six years ago for a version 8 application which has been in daily use since at multiple sites.

      I created a new test form in version 8. Everything runs fine using my memo script coding. So it appears that this is a version 11 issue that I just have not been able to resolve.

      Maybe someone else has run into this problem with migrating a version 8 application to a newer version of Alpha 5. I believe somewhere around version 9, changes were made to the browses.

      I've attached my test app with the form created in version 8 that is working as I want.

      Below is my most recent coding for the script 'memo'.





      Code:
      'Date Created: 09-Sep-2012 04:21:14 PM
      'Last Updated: 13-Sep-2012 09:48:25 AM
      'Created By  : Ron
      'Updated By  : Ron
      
      'debug(1)
      
      'the memo field on the form is READ ONLY
      
      DIM vcPar as C			'name of parent table
      DIM vcChild as C		'name of child table
      DIM vcChild_Id_Field_Name as C		'child ID field
      DIM vcBrowse_Id as C	'Name of Child Browse object
      DIM vcMemo_Field as C	'Name of field object that displays memo
      
      DIM vnParRec as N	'Parent Record Number
      DIM vnRec as N		'Child Record Number
      
      vcPar = "hdr"
      vcChild = "hdr_child"
      vcChild_Id_Field_Name = "Call_id"
      vcBrowse_Id = "Call_List"
      vcMemo_Field = "Notes"
      
      vnParRec = table.get(vcPar).recno()
      vnRec = table.get(vcChild).recno()
      
      DIM vcClient_Id as C
      vcClient_Id = table.current(1).Client_Id
      
      '' see if there are any phone records from this contact
      if Check_For_Records(vcChild, vcClient_Id) = .F. then
      	END
      end if
      
      parentform.Commit()
      
      DIM vcTtile as C	'memo editor title text
      vcTtile = "Add/Edit the Current Call Entry"
      
      DIM shared tbl as p
      tbl = table.get(vcChild)
      p.text=eval("tbl."+vcMemo_Field)
      
      dim vRec as N
      vRec = tbl.recno()
      
      'ui_msg_box("vRec",vRec)
      'end
      
      IF tbl.notes = "" .and. isnull(eval("tbl."+vcChild_Id_Field_Name) ) THEN
      	IF a5_memo_editor(p,vcTtile) = "Save" THEN
      		t = table.open(vcChild)
      		t.enter_begin()
      		eval("t."+vcMemo_Field) = p.text
      		t.enter_end()
      		t.close()
      
      	'*****************************************************************
      		'this is where I'm having trouble with the form
      		
      		ui_freeze(.t.)
      		xbasic_wait_for_idle()
      		eval("parentform:"+vcBrowse_Id+".activate()" )
      		tbl.fetch_goto(vRec)
      		parentform.Resynch()
      		ui_freeze(.f.)
      		sys_send_keys("{F5}")
      		goto cleanup
      	'*****************************************************************
      	ELSE
      		cancel()
      	END IF
      ELSE
      	IF a5_memo_editor(p,vcTtile) = "Save" THEN
      		vRec = tbl.recno()
      		t = table.open(vcChild)
      		t.fetch_goto(vRec)
      		t.change_begin()
      		eval("t."+vcMemo_Field) = p.text
      		t.change_end()
      		t.close()
      		parentform.Resynch()
      	ELSE
      		cancel()
      	END IF
      END IF
      
      eval("parentform:"+vcMemo_Field+".activate()")
      
      END
      
      cleanup:
      eval("parentform:"+vcMemo_Field+".refresh()" )
      END
      
      FUNCTION Check_For_Records as L ( Tbl as C ,Linking_ID as C )
      	
      	Check_For_Records = .T.
      	DIM nrecs as N
      	nrecs = a5_get_records_in_query(Tbl,"Client_id = " + quote(Linking_ID))
      	
      	if nrecs = 0 then
      		DIM SHARED vDlg_Title as C
      		DIM SHARED vMsg as C
      		vMsg="There Are Phone Calls To Memo"
      		DIM SHARED varC_result as C
      		DIM XDialogStyle as P
      		XDialogStyle.AccentColor = "Off White"
      		XDialogStyle.Color = "Light Yellow"
      		vDlg_Title="Oops"
      		dlg_text = <<%dlg%
      {Windowstyle=Gradient Horizontal}
      {font=Arial,11}{units=F}{xmargin=4,4}{ysize=.3};
      {image=$sys_Information}{sp}{sp}{sp}
      {text=%H=R%40,3vMsg};;
      {line=0};;{justify=center,Center}
      {font=Arial,10}
      <*12,1.5OK>;
      %dlg%
      		varC_result=ui_dlg_box(vdlg_title, dlg_text, <<%code%
      %code%)
      		Check_For_Records = .F.
      		end
      	end if
      	
      end function
      Attached Files
      Alpha 5 Version 11
      AA Build 2999, Build 4269, Current Build
      DBF's and MySql
      Desktop, Web on the Desktop and WEB

      Ron Anusiewicz

      Comment


        #4
        Re: Form refresh, resyc problem with a browse and memo field

        Please see attached Ron.
        After 2 days of head banging, I'd give up on the script and do it the easy way.
        You can always set variables once you have the process correct.
        Attached Files
        See our Hybrid Option here;
        https://hybridapps.example-software.com/


        Apologies to anyone I haven't managed to upset yet.
        You are held in a queue and I will get to you soon.

        Comment


          #5
          Re: Form refresh, resyc problem with a browse and memo field

          Originally posted by Ronald Anusiewicz View Post
          Ray,

          I did look at your suggestion, but this did not work....
          Ron,

          With your latest test files, simply putting entry_form:notes.Refresh() [or parentform:notes.Refresh()] after the parentform.Resynch() at line 84 works perfectly for me. "Me" being A5v10.5 build 4369-3712. Of course you are using v11, so that may well be the problem. Also, it may be that I have not fully understood what the problem is.

          Raymond Lyons

          Comment


            #6
            Re: Form refresh, resyc problem with a browse and memo field

            I got it to work changing the table.open() to table.get().
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: Form refresh, resyc problem with a browse and memo field

              Thank you to all who responded.

              As it turns out, my code for this particular process was in error. I�ve attached the corrected code. As I intend to use this code in numerous places, I retained the dim variables to make the code more easily portable.

              Ted,

              I like what you did. However; and maybe you can correct me if I�m wrong, I�m not sure if your approach leaves the memo file open until the user saves the record. I believe that my code opens the record only when reading and then when saving any changes.

              I believe your approach leaves the memo open until the user saves the record.

              I know that some of my users may start making a change, then answer the phone, need to help a customer, end up going to lunch and finally coming back an hour later and at that time finish what they started to do.

              The possible corruption of Memo fields scares me. Hence, I do not like to have them open any longer than neccesary.

              Does this make sense?

              Again, thank you all for your help.

              Ron


              Code:
              'the memo field on the form is READ ONLY
              
              DIM vcPar as C			'name of parent table
              DIM vcChild as C		'name of child table
              DIM vcMemo_Field as C	'Name of field object that displays memo
              DIM vcMemo_Field_Name as C	'name of memo field
              DIM vnRec as N		'Child Record Number
              
              vcPar = "hdr"
              vcChild = "hdr_child"
              vcMemo_Field = "Notes"
              vcMemo_Field_Name = "Notes"
              vnRec = table.get(vcChild).recno()
              
              DIM vcClient_Id as C
              vcClient_Id = table.current(1).Client_Id
              
              '' see if there are any phone records from this contact
              if Check_For_Records(vcChild, vcClient_Id) = .F. then
              	END
              end if
              
              parentform.Commit()
              
              DIM vcTitle as C	'memo editor title text
              vcTitle = "Add/Edit the Current Call Entry"
              
              DIM tbl as p
              dim t as P
              dim p as P
              dim p.text as C
              
              tbl = table.get(vcChild)
              p.text=eval("tbl."+vcMemo_Field_Name)
              
              IF a5_memo_editor(p,vcTitle) = "Save" THEN
              	t = table.open(vcChild)
              	t.fetch_goto(vnRec)
              	t.change_begin()
              	eval("t."+vcMemo_Field_Name) = p.text
              	t.change_end()
              	t.close()
              ELSE
              	cancel()
              END IF
              
              eval("parentform:"+vcMemo_Field+".activate()" )
              xbasic_wait_for_idle()
              eval("parentform:"+vcMemo_Field+".Refresh()" )
              
              END
              
              
              
              FUNCTION Check_For_Records as L ( Tbl as C ,Linking_ID as C )
              	
              	Check_For_Records = .T.
              	DIM nrecs as N
              	nrecs = a5_get_records_in_query(Tbl,"Client_id = " + quote(Linking_ID))
              	
              	if nrecs = 0 then
              		DIM SHARED vDlg_Title as C
              		DIM SHARED vMsg as C
              		vMsg="There Are Phone Calls To Memo"
              		DIM SHARED varC_result as C
              		DIM XDialogStyle as P
              		XDialogStyle.AccentColor = "Off White"
              		XDialogStyle.Color = "Light Yellow"
              		vDlg_Title="Oops"
              		dlg_text = <<%dlg%
              {Windowstyle=Gradient Horizontal}
              {font=Arial,11}{units=F}{xmargin=4,4}{ysize=.3};
              {image=$sys_Information}{sp}{sp}{sp}
              {text=%H=R%40,3vMsg};;
              {line=0};;{justify=center,Center}
              {font=Arial,10}
              <*12,1.5OK>;
              %dlg%
              		varC_result=ui_dlg_box(vdlg_title, dlg_text, <<%code%
              %code%)
              		Check_For_Records = .F.
              		end
              	end if
              	
              end function
              Alpha 5 Version 11
              AA Build 2999, Build 4269, Current Build
              DBF's and MySql
              Desktop, Web on the Desktop and WEB

              Ron Anusiewicz

              Comment


                #8
                Re: Form refresh, resyc problem with a browse and memo field

                I don't think that having the memo field open is the culprit Ron.
                It's the content that may corrupt it. The idea of having memo fileds in a separate table is a preferred method, and regular backups - say every � day might be OK but this depends on your throughput.
                Having it open means that it's locked, so going to lunch and coming back will mean that no one can access those notes. And they will still be there.
                You could put a timer on the form and close it after 5 minutes if no key action.
                See our Hybrid Option here;
                https://hybridapps.example-software.com/


                Apologies to anyone I haven't managed to upset yet.
                You are held in a queue and I will get to you soon.

                Comment


                  #9
                  Re: Form refresh, resyc problem with a browse and memo field

                  I'm coming into this a little late and haven't read everything (I'm busy enough that I shouldn't even be looking at this at all) but I see something that REALLY bothers me....

                  It looks like you are using Table.Open() to open a table that, I think, is visible in the current form - which means you could just use Table.GET(). I've said this many times before and will repeat it again - DO NOT USE TABLE.OPEN() TO MAKE CHANGES TO A RECORD IN THE CURRENT FORM. This includes adding new child records under the current parent record. Just use Table.GET(). Otherwise it is very difficult to refresh the current view. I find that in most cases it isn't necessary to use any "refresh" when using table.GET(). (I'm not sure; it may be necesssary when entering a new child record or deleting a record but maybe not and I'm sure it's usually not necessary for a simple edit of an existing record.)

                  FWIW, I have a generic memo_edit() function of my own and here's the few lines where I start the decision about how to save the memo changes:
                  Code:
                  IF eval_valid( "parentform:" + memo_obj_name + ".this" )
                  	'Since the memo field is on the form, we KNOW the table must be available also.
                  	IF parentform.Mode_Get() = "View"
                  		'This can be edited in table mode so the parent table/form are not affected.
                  		tp = [B]table.get[/B]( tablename )
                  		IF eval( "tp." + linking_field ) = linking_value
                  			tp.change_begin()
                  			....
                  		ELSE
                  			tp.enter_begin()
                  			....
                  		END IF
                  		eval( "parentform:" + memo_obj_name + ".refresh()" )
                  	ELSE
                  		....
                  Edit: I went back to check and saw that I did include the ".refresh()" but I'm still pretty sure it isn't always required. On the other hand, it always works and does NOT require doing a Resynch() first - which often messes up other things because it forces the record to save.
                  Last edited by CALocklin; 09-17-2012, 12:49 PM.

                  Comment

                  Working...
                  X