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

Having trbl/w string array crlf()?

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

    Having trbl/w string array crlf()?

    Hi All,

    I think I have programmer block here. It's probably so simple that i can't see it.

    This is just a clip of code in a script that builds a crlf() array to display in a xdialog box for selection.

    PICKS.delete()
    for x = 1 to z
    picks(x) = yr(x)+crlf() '(this is were i change code below)
    next

    If z " 1 then
    auto_list_ans = picks
    temp_count = w_count(auto_list_ans,crlf())
    ----------------------------------------------------
    after z is checked and "1, the program starts the xdialog code. When it reaches 'temp_count = w_count(auto_list_ans,crlf())' line i get this error;-

    "Argument is incorrect data type" the following lines display what 'picks' value is;

    Using the x loop without 'crlf()' -
    [1]="1996,[2]="1997,[3]="1998,[4]="1999,[5]="2000 (etc.)

    Using the x loop with 'crlf()' -
    [1]="1996"#0d#0a,[2]="1997"#0d#0a,[3]="1998"#0d#0a,[4]="1999"#0d#0a, (etc.)

    I know xdialog needs a character string/w crlf() to generate the selection box, but seems something wrong here?
    I do believe I wrote a similiar code way back, but didn't have this problem?

    Thanks,
    Mac

    #2
    RE: Having trbl/w string array crlf()?

    Mac,

    Its hard to give you a solid answer with out seeing more of the code.

    Your reference to yr(x) tells me you already have an array with the data you need, so why do it again?

    You might be able to just use a crlf delimited list opposed to an array, but I can't tell looking at this snippit of code.

    Would it be possible to supply more code?

    Scott

    Comment


      #3
      RE: Having trbl/w string array crlf()?

      Mac,

      Just so further help here.
      Lets say you had a list of data you wanted to use to create an array:

      'Using a crlf delimited list
      macs_list = ""%data%
      2000
      2001
      2002
      2003
      2004
      %data%

      cnt = w_count(macs_list,crlf())
      DELETE macs_array
      DIM macs_array[cnt] as C
      macs_array.initialize(macs_list)

      The above code produces this:
      macs_array[1] -" "2000"
      macs_array[2] -" "2001"
      macs_array[3] -" "2002"
      macs_array[4] -" "2003"
      macs_array[5] -" "2004"

      Now, if your list was in a string:
      data_list = "2000;2001;2002;2003;2004"
      cnt = w_count(data_list,";")
      for i = 1 to cnt
      macs_list = macs_list + word(data_list,i,";") + crlf()
      next i
      DELETE macs_array
      DIM macs_array[cnt] as C
      macs_array.initialize(macs_list)

      Hope this helps some.

      Scott

      Comment


        #4
        RE: Having trbl/w string array crlf()?

        Scott,

        Thanks for the sugestions, but can I ask ya a couple more questions? The variable yr(x) is an array built by the number of years data is present, but not with crlf(). That's why I was trying to get the crlf() in there. That way the xdialog box selection window would display the particular years I could persue.

        Next question: why is A5V5 generating the particular values displayed in the previous thread?

        any help appreciated Scott :)

        Mac

        Comment


          #5
          RE: Having trbl/w string array crlf()?

          Scott,

          Here is the whole script minus a couple of dim's :)

          DIM SHARED Z AS N
          DIM SHARED Q AS N
          DIM SHARED YR(Q) AS C
          DIM SHARED PICKS(z) AS C
          DIM SHARED H AS N
          DIM SHARED BASE AS C
          DIM SHARED BEGIN AS D
          DIM SHARED PATH AS C
          DIM SHARED SSN AS C
          DIM SHARED ans as C
          DIM SHARED varC_result as C
          Debug(0)
          PICKS.delete()
          for x = 1 to z
          picks(x) = yr(x)+crlf()
          next

          If z " 1 then
          auto_list_ans = picks
          temp_count = w_count(auto_list_ans,crlf())
          DELETE a_ans
          DIM a_ans[temp_count] as c
          a_ans.initialize(auto_list_ans)
          heading_string = "Pick the year you wish to see data:"
          footer_string = "Press "ok""
          ok_button_label = "&OK"
          cancel_button_label = "&Cancel"
          varC_result = ui_dlg_box("HISTORICAL YEARS",""%dlg%
          {region}
          {text=30,2:heading_string};
          {endregion};
          {region}
          Pick Year::| [%M%.4,5ans^#a_ans];
          {endregion};
          {region}
          {text=30,1:footer_string};
          {endregion};
          {line=1,0};
          {region}
          "*15=ok_button_label!OK" "15=cancel_button_label!CANCEL"
          {endregion};
          %dlg%)
          Else if z=1 then
          ANS = ui_get_list_array("Pick your year please -",1,"picks")
          If ans = "" then
          End
          End if
          End if

          vSelect = a_db_current_path+ans+"\pap_"+ans+".dbf"
          vCurrentShadowedTable = table.actual_filename_get("shadow")
          vShadowTable = table.filename_get("shadow")
          vChangeTo = Table.filename_get(vSelect)

          vCurrentLength = len(vCurrentShadowedTable)
          vNewLength = len(vChangeTo)

          if vCurrentLength " vNewLength
          vWriteLen = vCurrentLength
          else
          vWriteLen = vNewLength
          end if

          f = file.open(vShadowTable,FILE_RW_EXCLUSIVE)
          f.seek(67)
          f.write(vChangeTo,vWriteLen)
          f.close()

          '
          query.filter = "SSN=\"ssn\""
          query.order = "SSN"


          'Open the layout_type showing just the records that satisfy the filter
          DIM Shared varP_hist as P
          DIM layout_name as c
          layout_name = "hist@h:\a5v5\mds\shadow.ddd"


          dim tempP as p
          'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
          tempP=obj(":"+object_name_normalize(word(layout_name,1,"@")))
          'Test if pointer is valid
          if is_object(tempP) then
          'Test if pointer refers to a form or browse
          if tempP.class() = "form" .or. tempP.class() = "browse" then
          'Apply the query to the form or browse as the Base query. (this means that
          'the user cannot turn the query off, only add to the query)
          tempP.BaseQueryRun(query.filter,query.order)
          'then activate the already open window
          tempP.activate()
          else
          'Window is not already open, so open it
          varP_hist = :Form.viewqueried(layout_name,query.filter, query.order )

          end if
          else
          varP_hist = :Form.viewqueried(layout_name,query.filter, query.order )

          end if

          Comment


            #6
            RE: Having trbl/w string array crlf()?

            Mac,

            I am not sure I understand your questions ...

            Try this:

            Make your array yr global, run your routine to set the values.

            Now go to the interactive window and type the following then hit enter.

            ?yr

            Cut and paste the results for the above in a reply thread.
            Now type each line that starts with ? and hit enter:

            ?yr[1]
            ?yr[2]
            ?yr[3]

            Cut and paste the results for the above.
            Finally, type the following and again cut and paste the results.

            ?yr.dump()

            I am curious to see the results.

            Scott

            Comment


              #7
              RE: Having trbl/w string array crlf()?

              Scott,

              I'm sorry, but i've got another problem. I'm just about ready too give up on programming. This conversion from A5V1 to A5V5 has just about got me finished!

              Sorry

              Mac

              Comment


                #8
                RE: Having trbl/w string array crlf()?

                From what I can tell the parameters in "array".delete() are not optional so you probably want

                PICKS.clear()

                Can't see why your syntax is not working on building the crlf() delimited list. You could try

                "Using the x loop without 'crlf()' -"

                then

                auto_list_ans = stritran(picks ,",",crlf())

                to replace the commas with crlf()
                There can be only one.

                Comment


                  #9
                  RE: Having trbl/w string array crlf()?

                  I don't think you are actually building a crlf() delimited list. Your array dump shows that you have changed the comma to a clrf() but are still dealing with individual elements. (1]="1996"#0d#0a,[2]="1997"#0d#0a,[3]="1998"#0d#0a,[4]="1999"#0d#0a, (etc.))



                  Instead of

                  for x = 1 to z
                  picks(x) = yr(x)+crlf() '(this is were i change code below)
                  next

                  try

                  dim picklist as c
                  picklist = ""
                  for x = 1 to z
                  picklist = picklist + yr[x]+crlf()
                  next x
                  There can be only one.

                  Comment


                    #10
                    RE: Having trbl/w string array crlf()?

                    Or as Scott mentioned above:

                    dim picklist as c
                    picklist = yr.dump()

                    Comment


                      #11
                      RE: Having trbl/w string array crlf()?

                      See "ARRAY".DUMP().

                      Comment

                      Working...
                      X