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

Help with if statement

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

    Help with if statement

    I am trying not to delete the rtf field value is field lastedit is todays date, keep getting script errors here is the script
    Code:
    dim vTend as C
    vTend = convert_type(now(),"c")
    
    topparent.commit()
    dim ft1 as p
    ft1=topparent:free_text1_rtf.this
    ft2=topparent:free_text2_rtf.this
    lstnote=topparent.LSTNOTE1.this
    lastedit=topparent.lastedit.this
    ft1.rtf.set_cursor(1)
    ft1.rtf.insert_text("Start: " + vTstart+ crlf())
    ft1.activate()
    xbasic_wait_for_idle()
    textlen=len(ft1.rtf.plain_text)
    ft1.rtf.set_cursor(textlen+1)
    ft1.rtf.insert_text(crlf())
    xbasic_wait_for_idle()
    ft1.textselect(1,-1)
    ft1.rtf.cut()
    
    lstnote1.show()
    lstnote1.activate()
    'if statement here "if  current form object lastedit value is date()= .f. then" 
    lstnote1.textselect(1,-1)
    lstnote1.rtf.delete()
    'end if else
    lstnote1.rtf.set_cursor(1)
    lstnote1.rtf.paste()
    lstnote1.rtf.insert_text(vtend)
    lstnote.hide()
    
    xbasic_wait_for_idle()
    
    ft2.field.readonly=.f.
    ft2.activate()
    ft2.rtf.set_cursor(1)
    ft2.rtf.paste()
    ft2.rtf.insert_text("End: " + vTend + crlf())
    ft2.field.readonly=.t.
    topparent.commit()
    sys_send_keys("{F9}")
    https://www.housingeducator.org
    k3srg

    #2
    Re: Help with if statement

    Rereading made it clearer.

    I think you want

    if lastedit.value <> date()
    There can be only one.

    Comment


      #3
      Re: Help with if statement

      i keep getting error
      if(lastedit.value <> "date()")
      too few parameters
      and when i change things i get argument is invalid data type when i try this
      Code:
      'Date Created: 03-Apr-2009 02:33:21 PM
      'Last Updated: 03-Apr-2009 06:23:24 PM
      'Created By  : steven
      'Updated By  : steven
      dim vTend as C
      dim lastedit as C
      dim today as C
      vTend = convert_type(now(),"c")
      today = convert_type(date(),"c")
      topparent.commit()
      dim ft1 as p
      ft1=topparent:free_text1_rtf.this
      ft2=topparent:free_text2_rtf.this
      lstnote=topparent.LSTNOTE1.this
      lastedit=topparent.lastedit.this
      ft1.rtf.set_cursor(1)
      ft1.rtf.insert_text("Start: " + vTstart+ crlf())
      ft1.activate()
      xbasic_wait_for_idle()
      textlen=len(ft1.rtf.plain_text)
      ft1.rtf.set_cursor(textlen+1)
      ft1.rtf.insert_text(crlf())
      xbasic_wait_for_idle()
      ft1.textselect(1,-1)
      ft1.rtf.cut()
      
      lstnote1.show()
      lstnote1.activate()
      if(Lastedit.value<>today,lstnote1.textselect(1,-1)lstnote1.rtf.delete(),lstnote1.rtf.set_cursor(1)lstnote1.rtf.paste()lstnote1.rtf.insert_text(vtend)lstnote.hide()xbasic_wait_for_idle())
      
      ft2.field.readonly=.f.
      ft2.activate()
      ft2.rtf.set_cursor(1)
      ft2.rtf.paste()
      ft2.rtf.insert_text("End: " + vTend + crlf())
      ft2.field.readonly=.t.
      topparent.commit()
      sys_send_keys("{F9}")
      says line 29 is where the error is
      https://www.housingeducator.org
      k3srg

      Comment


        #4
        Re: Help with if statement

        Can someone help me clean this script up please, i can't seem to get the if statement working right, i want it to select all then delete an rtf memo field if field lastedit =date() here is my form on fetch and my button to send date to the rtf memo's on fetch
        Code:
        dim shared vTstarta as C
        dim shared vTstartb as C
        dim shared lviewed as C
        dim shared calla as T
        
        
        
        calla = a5_timestamp()
        lviewed = trim(convert_type(date(),"c"))
        vTstarta = convert_type(date(),"c")
        vTstartb = convert_type(time(),"c")
        on push
        Code:
        dim vTend as C
        
        dim today as C
        dim callb as t
        dim calltime as n
        dim lstnote as p
        vTend = convert_type(time(),"c")
        today = convert_type(date(),"c")
        callb = a5_timestamp()
        calltime =  callb - calla
        
        
        topparent.commit()
        dim ft1 as p
        ft1=topparent:free_text1_rtf.this
        ft2=topparent:free_text2_rtf.this
        lstnote=topparent:LSTNOTE1.this
        
        ft1.rtf.set_cursor(1)
        ft1.rtf.insert_text("Start: " + vTstarta + vTstartb + crlf())
        ft1.activate()
        xbasic_wait_for_idle()
        textlen=len(ft1.rtf.plain_text)
        ft1.rtf.set_cursor(textlen+1)
        ft1.rtf.insert_text(crlf())
        xbasic_wait_for_idle()
        ft1.textselect(1,-1)
        ft1.rtf.cut()
        
        LSTNOTE1.show()
        lstnote1.activate()
        textlen=len(lstnote1.rtf.plain_text)
        lstnote1.rtf.set_cursor(textlen+1)
        iif( a5_eval_expression("lsedit <> today"), LSTNOTE1.textselect(1,-1) + LSTNOTE1.rtf.delete(),end if) 
        	 
        textlen=len(lstnote1.rtf.plain_text)
        lstnote1.rtf.set_cursor(textlen+1)
        LSTNOTE1.rtf.paste()
        LSTNOTE1.rtf.insert_text(vtend + "Call Time" + totime(calltime,1,0))
        xbasic_wait_for_idle()
        LSTNOTE1.hide()
        ft2.field.readonly=.f.
        ft2.activate()
        ft2.rtf.set_cursor(1)
        ft2.rtf.paste()
        ft2.rtf.insert_text("End: " + vTend + crlf()+ "Call Time" + totime(calltime,1,0) + crlf())
        ft2.field.readonly=.t.
        topparent.commit()
        sys_send_keys("{F9}")
        
        
        End
        It looks like it should work to me but there has to somehthing this novice did wrong
        https://www.housingeducator.org
        k3srg

        Comment


          #5
          Re: Help with if statement

          Steven,
          Guesswork is what I believe you will receive when a script such as this is taken out of context where we cannot see errors and such. A sample database with instructions as to how to get to the problem, what results you are currently getting, and what results you want to get. Most likely but a few hours for an answer when this is done for most problems.

          But a guess is that this line is having problems-First off, what is the end if result for? An if() or iif() does not need it....if your argument is false what value do you want then--maybe "" ?
          Code:
          iif( a5_eval_expression("lsedit <> today"), LSTNOTE1.textselect(1,-1) + LSTNOTE1.rtf.delete(),end if)
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: Help with if statement

            Ok here a my sample dbase
            this one I have seem to sorted the error but it fires the if command everytime, which leads me to believe my variable isn't getting the data the way it needs to for this to fire correctly. there are 3 rtf fields on shortsale form one is really small almost hidden as this is just a tracking solution, when i type in notes in the middle rtf memo then hit save note it should look for field lastedit and IF value in field "lastedit" is not equal to date() which would return todays date. then it is to select all text in "lstnote1" then rtf.delete()
            then paste the text from the note in "lstnote1" and free_text2_rtf. Note always goto free_text2_rtf but for "lstnote1" I only want it to keep notes in there that were added that day.
            Last edited by steve745; 04-05-2009, 10:13 AM.
            https://www.housingeducator.org
            k3srg

            Comment


              #7
              Re: Help with if statement

              Steven,
              I won't have much time today but wanted to help in clarifying what it is that you are attempting.

              1..So IF the field "lastedit" is not equal to date(), you want to:
              2..first copy the text from lstnote1
              3..then delete the text in the lstnote1 field.
              4..paste the copied text into (not "and") free_text2

              So unless the note was created Today, you want the lstnote1 rtf field to be empty.

              It seems then that the free_text2 rtf field is going to be used for all text created over time (if so, you may want to add a date stamp to it).

              The above is just so that when I, or anyone else, fixes the sample it is done as you want and not how it is assumed to be wanted.

              Looking at the steps it is apparent now also that you should first do #4 prior to #3.
              Mike
              __________________________________________
              It is only when we forget all our learning that we begin to know.
              It's not what you look at that matters, it's what you see.
              Henry David Thoreau
              __________________________________________



              Comment


                #8
                Re: Help with if statement

                The text is selected on rtf1 then cut, and it always gets pasted to the other two rtf's but prior to pasteing to lstnote1 check if lastedit is today if not equal to today the select all in lstnote1 and then delete then continue to paste in both rtf's. Yes rtf2 gets all notes regardless, and lstnote1 only does the select all then delete if the date in lastedit in not today.
                I want to make a daily call summery for my boss instead of paper then typing it in to a word doc i can create a daily call log showing what the last call note was or notes for that matter for that day. Everything hangs on this darn if statement, working right.
                https://www.housingeducator.org
                k3srg

                Comment


                  #9
                  Re: Help with if statement

                  Steven,

                  How did you get

                  if(lastedit.value <> "date()")

                  out of the suggested

                  if lastedit.value <> date()

                  There were no quotes. The if(logical test, true result, false result) is completely different from

                  if logical test
                  'do this
                  end if

                  I was suggesting you substitute

                  if lastedit.value <> date()

                  for

                  'if statement here "if current form object lastedit value is date()= .f. then"
                  and then keep the original
                  end if
                  There can be only one.

                  Comment


                    #10
                    Re: Help with if statement

                    I ended up playing with this code for hours trying every different way i could even tried an inline xbasic, but have failed. I'm totally new to this coding, and want to understand it better because man this can open so many new ways to do operations.
                    https://www.housingeducator.org
                    k3srg

                    Comment


                      #11
                      Re: Help with if statement

                      WOW stan it works just like you told me to do it GO FIGURE, must have needed some sleep. Thanks i kept reading your post and then started trying again an wa la got it
                      https://www.housingeducator.org
                      k3srg

                      Comment


                        #12
                        Re: Help with if statement

                        Steven,

                        Glad you got it working/

                        voi�l�

                        You can copy and paste from this message board. Don't go to anymore effort than required. If you try to retype something and go astray, you'll get an error.

                        If you had tried what I suggested yesterday, it would have worked yesterday!
                        There can be only one.

                        Comment


                          #13
                          Re: Help with if statement

                          LOL it sure would have but yesterday it didn't make any sense the more i play with x basic the more i will learn, then i can help neubs like you do.
                          https://www.housingeducator.org
                          k3srg

                          Comment

                          Working...
                          X