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 on character Strings

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

    Help on character Strings

    I have a string value that is driving me nuts. The following works fine but when I try to change the Day_01 to a variable I cannot get the thing to work. Day_01 is in the string twice:

    ----------------------------
    ce = "case(word(Day_01,2)=\"Confirmed\",\"Pink on Pink\",word(Day_01,2)=\"Tentative\",\"Green on Green\",.T.,\"White on white\")"

    :Booking_View1:Browse1:Day_01.Field.Colorequation = ce
    --------------------------------------

    Does anyone have the solution or suggestions to try
    -----------------------------------------------
    Regards
    Mark Pearson
    [email protected]
    Youtube channel
    Website

    #2
    Re: Help on character Strings

    Hi Mark,
    Make sure first that your variable is dimmed as character. Also, dependent upon where you are using the variable from, you should try dimming either shared or global....context is very important, not only when scripting/coding, but also when asking questions here. Also make certain that your variable has a value.
    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


      #3
      Re: Help on character Strings

      Code:
      ce = "case(word(Day_01,2)=\"Confirmed\",\"Pink on Pink\",word(Day_01,2)=\"Tentative\",\"Green on Green\",.T.,\"White on white\")"
      ? ce
      = case(word(Day_01,2)="Confirmed","Pink on Pink",word(Day_01,2)="Tentative","Green on Green",.T.,"White on white")
      
      my_var  = "Day_02"
      
      
      ce = "case(word("+var->my_var+",2)=\"Confirmed\",\"Pink on Pink\",word("+var->my_var+",2)=\"Tentative\",\"Green on Green\",.T.,\"White on white\")"
      ? ce
      = case(word(Day_02,2)="Confirmed","Pink on Pink",word(Day_02,2)="Tentative","Green on Green",.T.,"White on white")
      There can be only one.

      Comment


        #4
        Re: Help on character Strings

        Thanks I got the variable to work but have now developed another problem with it.

        What I do is in the init of a form.

        What happens is that I do a loop that changes the column title of all columns based on dates. As the title needs to be a changing variable, I place it into a char variable based on the Column Browse Object. This is then put inor a pointer using the obj(). This process works fine.

        Then I wanted to do a simlar change using teh same process that made the field color based on the string. I can get it all to work using a button and only changing the one field, but when I place it in the loop I can't get it to work.

        I have attached the code if anyone can rationlise the problem
        -----------------------------------------------
        Regards
        Mark Pearson
        [email protected]
        Youtube channel
        Website

        Comment


          #5
          Re: Help on character Strings

          Might be as simple a change as adding the escape backslash...
          Code:
          dat3 = "<xdlg>{\"" +  dat2 + [SIZE=4][COLOR=Red]\[/COLOR][/SIZE]"}{sort_order}{stickto=center}"

          Mark, Notice that I can add your code with formatting directly to a message--using the advanced reply the "#" icon is a code wrap that does this.
          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 on character Strings

            I think Mike is on the right track.

            Code:
            dat2 = 7
            
            ? "<xdlg>{\"" +  dat2 + "}{sort_order}{stickto=center}"
            = <xdlg[COLOR="Red"]>{"7}{sort_order}{stickto=center}[/COLOR]
            
            ? "<xdlg>{\"" +  dat2 + "\"}{sort_order}{stickto=center}"
            = <xdlg>{"7"}{sort_order}{stickto=center}
            Is <xdlg>{"7"}{sort_order}{stickto=center}

            what the properly constructed line should look like?
            There can be only one.

            Comment


              #7
              Re: Help on character Strings

              You can replace

              Code:
              mynum2 = alltrim(str(mynum))
              	if len(mynum2) = 1 then
                  		mynum2 = "0" + mynum2
                  	else
                  		mynum2 = mynum2
              	end if
              with

              Code:
              mynum2 = padl(alltrim(str(mynum),2,"0"))
              There can be only one.

              Comment


                #8
                Re: Help on character Strings

                Thank you everyone. the problem was (and probably always is ) ME. To test this I created a duplicate view so the I could always delete later but not ruin what I had done so far. Sort of backup un the fly. I finally noted that I had gotten myself confused with the view name in the object. When I corrected this I t worked. As always another problem arose

                I was doing this process as it was mentioned in an earlier post that it may speed the view build up. Unfortunately it did not. attached is the db. What happens is you click the show bookings button. This runs a script show bookings. This script:

                1. Shows a calendar to select date
                2. Runs a script to blank rooms. For this process to work I could see anyother way for the browse to work. I wanted a view with all rooms including ones with no bookings etc
                3.Runs a scipt "gateopen' to find all books and set the room db to reflect bookings
                4. Opens the Occupancy graph which has a browse with bookings on it.

                On my machine at home - pretty new with 4gb of RAM it runs the process reasonably quick
                On my one at work with 2GB of ram it seems to hang for some time but then gets there in teh end. I incoporated a wait dialog to show where it hangs.

                Be really happy if anyone can see a way to speed the process up
                -----------------------------------------------
                Regards
                Mark Pearson
                [email protected]
                Youtube channel
                Website

                Comment


                  #9
                  Re: Help on character Strings

                  I thought I had answered this but has not appeared yet, so if this appears twice please ignore one.

                  As it turns out the problem ended up being me(usually does- ask the wife). I had duplicated the view so that I could do the playing without currupting the key form. In doing so I got myself confused with the object naming convetions and was doing the right thing on the wrong form!!

                  Anyway this all started in trying to speed things up in a process that I do to view a form. I found I had a serious slowdown which would make the user angry (computer speed is vital to a user patience). It was mentioned in another post that this may speed things up, well it didn't.

                  attached is the db. The slow down occurs when you click show bookings button. This does a number of things

                  1.asks for a start date
                  2.blanks a number of fields in a table
                  3.fills records in the same db with data from the booking table
                  4.opens the occupancy graph view. An embeeded browse

                  If I run the script independantly they all take no time at all. If open the view on its owns it is lightning quick.

                  But when it is done in the sequence above it slows to a hefty pause between the last script and the view opening.

                  Can anyone can add some possible solutions to this problem. It may be that it is just the way it is.

                  note if you try double click on the browse when it is open, there may be no response as I have not linked a lot of the records that I was playing with.
                  -----------------------------------------------
                  Regards
                  Mark Pearson
                  [email protected]
                  Youtube channel
                  Website

                  Comment


                    #10
                    Re: Help on character Strings

                    If I run the script independantly they all take no time at all.
                    I found that it only ran a little bit faster running it this way---over 8 seconds either way. If there is a way to add batch_begin/end it would help...but I got errors and a bit too late now---only thing I can suggest as your scripting seems fine actually.

                    Iterating through every record takes a bit of time, but looks like this is a requirement for your scenario.....would think there would be a way to hard code the fields in the table and then just write the data that way---then filter what columns show up in your browse??? Just a thought as it would reduce your processing down a bit.
                    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


                      #11
                      Re: Help on character Strings

                      Thanks Mike,

                      I found myself going for this structure as it was the only to get a browse to show all bookings and vacancies for a given period. Doing this I still had to restrict the period to a month for processing. The complexity of the booking process being displayed in this way seemed to be the only way to do it using a browse.

                      if there is another way to achieve this I would like to know
                      -----------------------------------------------
                      Regards
                      Mark Pearson
                      [email protected]
                      Youtube channel
                      Website

                      Comment


                        #12
                        Re: Help on character Strings

                        Mark,

                        in your gaterooms script it seems you're running the same query each time through the outer loop. Is that necessary? Running it once would be faster.

                        in the setrooms function you open, query, and close a table each time the Fn is called. Since the Fn is inside a loop and gets called repeatedly you could speed things up by leaving the table open.

                        Comment


                          #13
                          Re: Help on character Strings

                          Morning Tom,
                          I had a bit of time this am and checked out the setrooms() function. Taking the table open/close outside does trim off about 2 seconds--so now just over 6 seconds to run.

                          Mark,
                          I don't think that the small amount of processing prior to showing the browse is unacceptable really, especially since you do have a wait dialog that shows progress. It would be quite different if the browse itself showed this time delay when doing something....which it does not. Myself, I would leave it and tweak if ways are found.
                          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


                            #14
                            Re: Help on character Strings

                            Thanks guys,

                            I appreciate your time and advice. I continue try tweeks but no real change. When I look at the process it has 31 days to go through each time so it should remain reasonably consistent in time. I will see what happens when I add another 100 rooms with bookings in it. It was not meant to do any more than about 30 rooms, just interested in what I have done now and how I can apply it elsewhere.
                            -----------------------------------------------
                            Regards
                            Mark Pearson
                            [email protected]
                            Youtube channel
                            Website

                            Comment


                              #15
                              Re: Help on character Strings

                              Ok - I added another 100 rooms, then some bookings and found it still only took the same amount of time so I can live with that. I think if I added more fields it would have issues but I don't need to do that. I did find another glitch with my double click on the browse while testing so it is always the never ending follow the loop process when you do things.

                              Thanks for all your help on this I really appreciate your time
                              -----------------------------------------------
                              Regards
                              Mark Pearson
                              [email protected]
                              Youtube channel
                              Website

                              Comment

                              Working...
                              X