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

Xdialog How To Make Static Text Dynamic?

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

    Xdialog How To Make Static Text Dynamic?

    I have this function working pretty much as I want, except I am trying to change the text that displays below the file selection boxes and can't figure it out. I included the default text file used in the script and another for testing. They should be put on the root (C:) drive. If you have a different text editor you can select it. You can import the function into the control panel.

    Also I would like the checkboxes to always be disabled but can live with it the way it is...

    Get_TxtFile2.txt <-New and improved version
    NSI_INVREP.TXT
    NSI_INV1.TXT

    All examples appreciated!
    Last edited by MoGrace; 02-08-2015, 12:48 PM. Reason: replaced function
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    #2
    Re: Xdialog How To Make Static Text Dynamic?

    Don't have the tln() function necessary for

    Tln("Flag",flag)

    Also what does

    I am trying to change the text that displays below the file selection boxes
    mean?
    Last edited by Stan Mathews; 02-07-2015, 09:39 PM.
    There can be only one.

    Comment


      #3
      Re: Xdialog How To Make Static Text Dynamic?

      I set the default text shown in the attached image to appear disabled, and when the user tabs out of the field or uses enter the checkbox to the right should show if the file is found and the text should confirm in Blue or Red if it was or wasn't. Tln() is just my wrapper for the trace.writeln function - you can comment it out or import it.

      Tln1.txt

      get_txtfile.jpg

      It may be because I made this a modeless dlg - I remember Allen saying there was a difference in how the scripts get processed. I thought using a placeholder was all it needed - but of course I am wrong!
      Last edited by MoGrace; 02-08-2015, 12:30 AM.
      Robin

      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

      Comment


        #4
        Re: Xdialog How To Make Static Text Dynamic?

        I fixed the function and replaced it in Post #1. Now all I need to add is the button that will transform the selected file into one ready to import...
        Robin

        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

        Comment


          #5
          Re: Xdialog How To Make Static Text Dynamic?

          Robin do good.

          Xdialog fun!
          Al Buchholz
          Bookwood Systems, LTD
          Weekly QReportBuilder Webinars Thursday 1 pm CST

          Occam's Razor - KISS
          Normalize till it hurts - De-normalize till it works.
          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
          When we triage a problem it is much easier to read sample systems than to read a mind.
          "Make it as simple as possible, but not simpler."
          Albert Einstein

          http://www.iadn.com/images/media/iadn_member.png

          Comment


            #6
            Re: Xdialog How To Make Static Text Dynamic?

            Can somebody tell me what I ought to do with the section in blue? It only writes the first line n number of times. This is going to be the other button script that converts the file. (not finished)

            Code:
            dim in_file as c = "c:\nsi_inv1.txt"
            dim out_file as c = "c:\a5v11\nsi\nsi_rep\nsi_invrep.txt"
            dim out_ptr as p
            dim tmp_filename as c = "c:\tmpfile.txt"
            dim tmp_ptr as p
            dim in_str as c
            dim in_cnt as n
            dim out_str as c
            dim out_cnt as n
            dim pg_cnt as n
            dim pg_Lns as n = 61
            dim ovr_flag as L = .f.
            dim f_mask as c = space(7)+";"+space(25)+";"+space(12)+";"+space(13)+";"+space(10)
            dim hdr_Ln as c = "INVNO;BILLTO1;QUANTITY;DATEIN;TERMS;AMOUNT"
            dim in_Ln as c
            dim out_Ln as c
            
            if in_file = "" then
            	in_file = ui_get_file("Open Text File","Text (*.txt)","c:\a5v11\nsi\nsi_rep\\","X")
            	if in_file = "" then
            		'user cancelled
            		end
            	end if
            end if
            
            in_str = get_from_file(in_file)
            in_cnt = line_count(in_str)
            pg_cnt = ceiling(abs(in_cnt / pg_Lns))
            out_str = *line_remove(in_str,in_cnt-5,6) 'removes the report footer first
            
            if pg_cnt > 1 then	'2 or more pages in report
            	'remove last header first
            	i = pg_cnt+1
            	for i = i to 2 STEP -1
            		n = pg_Lns * (pg_cnt-1)	'Ex: 3 pages, 2nd hdr begins on line 61; 3rd hdr on line 122
            		out_str = *line_remove(out_str,n,12)
            		pg_cnt = pg_cnt-1
            	next
            	if pg_cnt = 1 .or. i = 2 then
            		out_str = *line_remove(out_str,1,12)
            	end if 
            else
            	'report is only 1 page so remove the header
            	out_str = *line_remove(out_str,1,12)
            end if
            
            msgbox("Output Text",out_str)
            response = msgbox("Confirm Output Text","Ready to convert to new file for importing?",33)
            if response = 2 then
            	'user cancelled
            	end 
            else
            	save_to_file(out_str,tmp_filename)
            end if
            
            'tmp_ptr = file.open(tmp_filename,FILE_RW_EXCLUSIVE)
            'continue to use out_str as source
            if file.exists(out_file) then
            	file.remove(out_file)
            end if
            
            on error goto ENDIT
            out_ptr = file.create(out_file,FILE_RW_EXCLUSIVE)
            out_ptr.write_line(hdr_Ln)
            
            [COLOR="#0000FF"]for each foo in out_str
            	'in_Ln = strtran(tmp_ptr.read_line(),chr(12),"")
            	in_Ln = strtran(out_str,chr(12),"")	'check each line for a FF character
            	if left(in_Ln,1) = "" then		'good text may have leading blank space
            		if left(in_Ln,2) <> "" then	'should skip a blank line
            			out_Ln = substr(mask(in_Ln,f_mask),2)
            			out_ptr.write_line(out_Ln)
            		end if		
            	end if
            next[/COLOR]
            out_ptr.flush()	'writes the cache to the variable
            ENDIT:
            out_ptr.close()
            sys_open(out_file)
            Last edited by MoGrace; 02-08-2015, 06:59 PM.
            Robin

            Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

            Comment


              #7
              Re: Xdialog How To Make Static Text Dynamic?

              I think this line
              Code:
              in_Ln = strtran([COLOR="#FF0000"]out_str[/COLOR],chr(12),"")	'check each line for a FF character
              should be
              Code:
              in_Ln = strtran([COLOR="#FF0000"]foo[/COLOR],chr(12),"")	'check each line for a FF character
              Tim Kiebert
              Eagle Creek Citrus
              A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

              Comment


                #8
                Re: Xdialog How To Make Static Text Dynamic?

                Thanks Tim,
                it took me a while to see it. Now my only problem is getting the import operation to work with this file. The commas in the numeric fields were the first problem - removing them messed with the fixed width. I was hoping to skip opening in Excel - not that it helped much. I am about to give this XD business up and go back to a form...
                Robin

                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                Comment


                  #9
                  Re: Xdialog How To Make Static Text Dynamic?

                  Instead of just removing the commas can you not replace them with something else like a space.
                  Tim Kiebert
                  Eagle Creek Citrus
                  A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                  Comment


                    #10
                    Re: Xdialog How To Make Static Text Dynamic?

                    When I removed the commas in the numeric fields in a text editor the spacing was no longer fixed. If I put a space there, I would still have to remove it or put the space in front of the numbers . So my script would have to jump thru even more hoops!

                    In my sample report file, because the date is 1/30/2015, there are 2 leading spaces. This field should be '01/30/15' for importing, although '1/30/15' also works. What doesn't work is '1/30/2015'. The date field will take 8 or less chars but not more.

                    Stan's suggestion of using mask() is good but I am having some trouble with the number of spaces between the fields as well as field alignment and fixing the 'date' field so Alpha will import it correctly. I was hoping to accomplish it all with a script and not have to open an editor or Excel... And when the file is done, hopefully it will match the table fields exactly.

                    So my TABLE fields are a total of 69 chars, whereas my report char count is 79.

                    INVNO C,6
                    BILLTOLINE1 C,25
                    QUANTITY N,10,2
                    SHIPDATE D,8
                    TERMS C,10
                    AMOUNT N,10,2

                    so should my mask be:

                    space(6)+";"+space(25)+";"+ etc. - like my table?

                    or

                    space(7)+";"space(26)+";"+ etc. to accommodate for the space between the report fields?

                    per wiki:
                    Description

                    MASK() inserts characters from Unformatted_String into Template_String to replace all of the spaces in Template_String and returns the newly formatted string. Non blank characters in Template_String are included in the output Formatted_String. To include a space in the Formatted_String, use the pipe character ( | ) in the Template_String.
                    Last edited by MoGrace; 02-10-2015, 04:02 PM.
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                      #11
                      Re: Xdialog How To Make Static Text Dynamic?

                      This is my first conversion - which at least now has field markers in it:

                      Code:
                      INVNO;BILLTOLINE1;QUANTITY;SHIPDATE;TERMS;AMOUNT
                      31763 ;Actex Trading, LLC       ;  3,741.00;  1/30/2015 ;NET 30        ; 1,421.58 
                      31764 ;Bentex Cotton Ind.       ;  5,587.00;  1/30/2015 ;NET 30        ; 2,667.00 
                      31765 ;Fairway Trading, Inc.    ; 22,415.90;  1/30/2015 ;NET 30        ; 8,408.16 
                      31766 ;Gil Land                 ;  1,149.00;  1/30/2015 ;NET 30        ;   618.10 
                      31767 ;I Q Textile Ind., Inc.   ;  9,806.00;  1/30/2015 ;NET 30        ; 4,665.00 
                      31768 ;Laguna Fabrics           ;    724.00;  1/30/2015 ;NET 30        ;   398.20 
                      31769 ;Isigalo Llc              ;    315.40;  1/30/2015 ;NET 30        ;   110.39 
                      31770 ;Millknits                ;  3,794.00;  1/30/2015 ;NET 30        ; 1,990.70 
                      31771 ;Pacific Sourcing Group   ;  9,950.00;  1/30/2015 ;NET 30        ; 2,301.85 
                      31772 ;Sun Dragon Import, Inc.  ;  8,408.80;  1/30/2015 ;NET 45        ; 3,012.68 
                      31773 ;The Destiny Group, Inc.  ;  6,479.00;  1/30/2015 ;NET 30        ; 3,406.69
                      Robin

                      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                      Comment


                        #12
                        Re: Xdialog How To Make Static Text Dynamic?

                        Robin you could easily write to the table as you build your converted file. In your conversion code add:

                        Code:
                        [COLOR="#FF0000"][/COLOR][COLOR="#FF0000"]tbl = table.open("your import table")
                        vncount = 1[/COLOR]
                        for each foo in out_str
                        	'in_Ln = strtran(tmp_ptr.read_line(),chr(12),"")
                        	in_Ln = strtran(foo,chr(12),"")	'check each line for a FF character
                        	if left(in_Ln,1) = "" then		'good text may have leading blank space
                        		if left(in_Ln,2) <> "" then	'should skip a blank line
                        			out_Ln = substr(mask(in_Ln,f_mask),2)
                        			[COLOR="#FF0000"]if vncount >=2 'need to skip field names
                        				tbl.enter_begin()
                        				tbl.invno.value = word(out_ln,1,";")
                        				tbl.billtoline1.value = word(out_ln,2,";:)
                        				tbl.quantity.value = word(val(strtran(out_ln,",","")),3,";")
                        				tbl.shipdate.value = word(ctod(out_ln),4,";")
                        				tbl.terms.value = word(out_ln,5,";")
                        				tbl.amount.value = word(val(strtran(out_ln,",","")),6,";")
                        				tbl.enter_end(.t.)
                        			end if[/COLOR]
                        			out_ptr.write_line(out_Ln)
                        		end if
                        	[COLOR="#FF0000"]vncount = vncount +1[/COLOR]
                        	end if
                        next
                        tbl.close()

                        Comment


                          #13
                          Re: Xdialog How To Make Static Text Dynamic?

                          Allen,
                          Where were you 3 days ago? lemme try it...

                          Well that certainly ends my struggle today with leading and trailing spaces in the 'date' field!

                          Thank you so much!
                          Last edited by MoGrace; 02-10-2015, 06:31 PM.
                          Robin

                          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                          Comment


                            #14
                            Re: Xdialog How To Make Static Text Dynamic?

                            Glad it helped!

                            Comment


                              #15
                              Re: Xdialog How To Make Static Text Dynamic?

                              I changed your syntax a bit - but even so you got me on the right track for how to do this simply:

                              Code:
                              for each foo in out_str
                              	out_Ln = foo.value
                              	on error goto ERRMSG
                              	tbl.enter_begin()
                              		on error goto 0		
                              		tbl.invno = word(out_ln,1,";")		
                              		tbl.billtoline1 = word(out_ln,2,";")
                              		tbl.quantity = val(word(strtran(out_ln,",",""),3,";"))						
                              		tbl.shipdate = ctod(alltrim(word(out_Ln,4,";")))
                              		tbl.terms = word(out_ln,5,";")
                              		tbl.amount = val(word(strtran(out_ln,",",""),6,";"))		
                              	tbl.enter_end(commit_flag)	
                              	cnt = cnt+1									
                              next
                              Now all I need to do is make it into a function and add it to the Xdialog...
                              Robin

                              Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                              Comment

                              Working...
                              X