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

Copy Memo field

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

    Copy Memo field

    I'm having problems copying a memo field from one record on the current form, to another record on the same form.

    I've tried table.current / table.get / and table open (another instance), and goto(recno) - all without success.

    I get a "Permission denied" message.

    Parentform:Ser_desc.value = vCopy

    Is there something special about writing to a memo field? Is there a duplicate method for one field between records?

    Thanks for taking a look.

    ~ Tom

    #2
    Re: Copy Memo field

    Are you speaking of copying the memo in a record, navigating to another record, and putting the memo field value in the memo field in the target record? Plain or rtf memo?
    " on the same form." is confusing to me, sorry.

    Just tested (V11) with a plain memo field object name pmem. Get the contents of the memo field object in the current record (button)

    dim shared cont as C
    cont = pmem.value

    Navigate to another record.

    Put that into same memo field

    dim shared cont as C
    pmem.value = cont

    With an rtf memo I had to

    get -

    dim shared cont as B
    tbl = table.current()
    cont = tbl.PMEM

    put -

    dim shared cont as B
    tbl = table.current()
    tbl.change_begin()
    tbl.PMEM = cont
    tbl.change_end()
    parentform.Resynch()
    Last edited by Stan Mathews; 04-25-2018, 08:50 PM.
    There can be only one.

    Comment


      #3
      Re: Copy Memo field

      Stan,

      Yes, "Are you speaking of copying the memo in a record, navigating to another record, and putting the memo field value in the memo field in the target record?" A regular memo field.

      I'll try this in the morning and let your know.

      Thanks,

      ~ Tom

      Comment


        #4
        Re: Copy Memo field

        I couldn't wait. I had to try it and it worked.

        I had to use table.current().memofield = cont

        The following did not work.
        Parentform:memofield.value = cont

        Hopefully it will work in the morning!

        ~ Tom

        Comment


          #5
          Re: Copy Memo field

          Oops - doesn't work when choosing Recno from Array.

          This works and fills the field correrctly:

          dim shared cont as C
          cont = Parentform:Ser_Desc.value

          'Navigate to another record.
          parentform.Recno_goto(100)

          dim shared cont as C
          parentform:Ser_Desc.value = cont

          parentform.commit()
          But when I select the Recno_goto from the following array, it doesn't work.


          dim t as p

          t=table.open("AL_POC",FILE_RO_SHARED)
          'indx = inputf.index_get("zNameu")
          'records = indx.records_get()
          query.filter="Pte_id=var->v_Pteid.and.END_DATE={}"
          query.order="Shift"
          query.options="I" 'U=Unique or I or ""
          idx=t.query_create()

          dim choices(idx.records_get()) as c
          t.fetch_first()
          i=1
          while .not. t.fetch_eof()
          choices[i]= trim(t.Shift)+Space(3)+Trim(T.category) +space(3)+t.recno() '+t.poc_id 'ideally an indexed field
          i=i + 1
          t.fetch_next()
          end while

          sort_array("choices")
          vPocid = ui_get_list_array("Select Shift",1,"choices") 'check the syntax here
          idx.drop()
          t.close()

          vPocid = alltrim(Word(vPocid,-1))

          IF vPocid = ""
          END
          END IF

          ui_msg_box("Selection",vPocid)

          parentform.Recno_goto(val(vPocid)) - YES this moves to the correct record.

          dim shared cont as C
          'parentform:Ser_Desc.value = cont - these two lines don't work to change the record.
          table.current().Ser_Desc = cont

          parentform.commit()

          parentform.Recno_goto(vRecno)

          UI_Msg_box("Done","Service Description Copied to another Shift.")

          END
          The above process leaves the form such that I can't manually enter the text either.

          What do you suggest?

          ~ Tom

          Comment


            #6
            Re: Copy Memo field

            Put

            msgbox(topparent.Mode_Get())

            after the recno_goto() and see what is the form state.
            There can be only one.

            Comment


              #7
              Re: Copy Memo field

              msgbox(topparent.Mode_Get()) = VIEW

              If I stop the script at this spot, I cannot type into the memo field and the pencil icon in the top right corner doesn't work.

              If I leave the form, and return, I can edit the memo field and use the pencil.

              Hhmmm...

              ~ Tom

              Comment


                #8
                Re: Copy Memo field

                Without seeing the form.......?

                Any onfetch event code? No code anywhere to disable the memo field or make it read only? Nothing to make data entry modal so you have to Allow Edits first?
                New msgbox to replace the mode_get().

                msgbox("Memo field object enabled is "+convert_type(parentform:ser_desc.object.enabled,"C"))

                I'll try to come up with some more.

                Any behavior diff if you add

                parentform:ser_desc.Enable()

                before trying to assign the value?

                Did you try a debug(1) just before the assignment. Sometimes you will see a minor error in the debugger that doesn't throw an overall error message.
                There can be only one.

                Comment


                  #9
                  Re: Copy Memo field

                  This is an old form with lots of code.

                  I don't want to take up too much of your time.

                  Let me try a workaround. Maybe I could append/replace the field.

                  It may be the query used when opening the form that locks it somehow, although the shore cut below works.

                  dim shared cont as C
                  cont = Parentform:Ser_Desc.value

                  'Navigate to another record.
                  parentform.Recno_goto(100)

                  dim shared cont as C
                  parentform:Ser_Desc.value = cont

                  parentform.commit()
                  Its only when I try to get the recno from the array, that I get a "Permission Denied" error.

                  ~ Tom

                  Comment


                    #10
                    Re: Copy Memo field

                    If you keep working on it don't forget the code explorer in form design mode. You can search for ser_desc, disable, etc.
                    There can be only one.

                    Comment


                      #11
                      Re: Copy Memo field

                      I created a simplistic example using an array and using the choice from the array to choose which record to go to. It works for me so the issue is likely with something on your form.

                      If you want to try it unzip the two tables somewhere, add them to a database or create a new one. Use the rec button on the form.

                      atest.zip
                      There can be only one.

                      Comment


                        #12
                        Re: Copy Memo field

                        Thanks Stan.

                        I downloaded your example.

                        I tried putting in about 2-3 pages of text, and if fails! I didn't think there was a limit.

                        The memo editor itself only seems to save about a page of characters.

                        ~ Tom
                        Last edited by Tom Patten; 04-27-2018, 12:56 AM.

                        Comment


                          #13
                          Re: Copy Memo field

                          I wasn't considering that much content in the memo field.

                          change

                          dim shared cont as C

                          to

                          dim shared cont as B
                          There can be only one.

                          Comment


                            #14
                            Re: Copy Memo field

                            In your example, try getting 2-3 pages of text to save in the memo field. I'm hitting a limit.

                            Edit: Still not working.

                            How about using table methods, instead of using the form.

                            open table
                            Navigate to record
                            table.change_begin
                            ...

                            I did the above and got "Access Denied" error.
                            Table must be "in use"

                            ~ Tom

                            PS: Good Morning ;-)
                            Last edited by Tom Patten; 04-27-2018, 10:04 AM.

                            Comment


                              #15
                              Re: Copy Memo field

                              Good morning!

                              Image 11.png

                              This worked here.

                              Sometimes the form object doesn't update until navigating away from the record and back.



                              This should do it with table methods.

                              Code:
                              dim shared cont as B
                              tbl = table.current()
                              cont = tbl.m
                              dim t as p
                              
                              t=table.open("atest2",FILE_RO_SHARED)
                              
                              query.filter="isnotblank(\"name\")"
                              query.order="name"
                              query.options="I" 'U=Unique or I or ""
                              idx=t.query_create()
                              
                              dim choices(idx.records_get()) as c
                              t.fetch_first()
                              i=1
                              while .not. t.fetch_eof()
                              	choices[i]= str(t.id,4,0)
                              	i=i + 1
                              	t.fetch_next()
                              end while
                              
                              sort_array("choices")
                              vPocid = ui_get_list_array("Select Shift",1,"choices") 'check the syntax here
                              idx.drop()
                              t.close()
                              
                              vPocid = alltrim(vPocid)
                              
                              IF vPocid = ""
                              	END
                              END IF
                              
                              ui_msg_box("Selection",vPocid)
                              
                              parentform.Recno_goto(val(vPocid))' - YES this moves to the correct record.
                              
                              dim shared cont as B
                              tbl.fetch_goto(val(vPocid))
                              tbl.change_begin()
                              tbl.m = cont
                              tbl.change_end()
                              parentform.Resynch()
                              parentform.commit()
                              
                              UI_Msg_box("Done","Service Description Copied to another Shift.")
                              
                              END
                              Last edited by Stan Mathews; 04-27-2018, 10:06 AM.
                              There can be only one.

                              Comment

                              Working...
                              X