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

Why is this occuring?

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

    Why is this occuring?

    In my script, one option is to edit a file before processing it in another option, the trouble is , it will only work if I include the "ShowVar" statement for the variable ..

    the code in my script:

    Code:
    if left(a_dlg_button,18) = "vLogFileNameEvent_" then
        showFilename = .f.
        if a_dlg_button = "vLogFileNameEvent_popupdone" then
            vLogFileText = get_from_file(vLogFileName)
        [COLOR=#ff0000]    showvar(vLogFileText)[/COLOR]
            select
                case Len(rtrim(vLogFileText)) = 0
                    ui_msg_box("Error:","File "+file.filename_parse(vLogFileName,"n")+" is Empty",UI_ATTENTION_SYMBOL)
                    ShowEdit = .f.
                    a_dlg_button = ""
                case left(vLogFiletext,1) <> "#"
                    ui_msg_box("Error: ","File "+file.filename_parse(vLogFileName,"n")+" has no Header",UI_ATTENTION_SYMBOL)
                    ShowEdit = .f.
                    a_dlg_button = ""
                case else
                    ShowEdit = if(vOpt="Edit Logging",.t.,.f.)
                    a_dlg_button = ""
            end select
            a_dlg_button = ""
        end if
        a_dlg_button = ""
    end if
    If the showvar statement is excluded the script shows a blank variable, but when it is included the variable shows correctly. I've been stuck on this for weeks now and it is driving me nuts!

    when I created a test version with just this element, it works with or without the showvar statement. "Input Logging" option, just loads the file and does error checking.

    Code:
    dlg_title = "testing"
    showedit = .f.
    showfilename = .f.
    dim vLogFileText as c
    ui_dlg_box(dlg_title,<<%dlg%
    {region}
    (vOpt:Input Logging)(vOpt:Edit Logging)
    {watch=vOpt!vOptEvent}
    {endregion};
    {region22}    
    {condition=(ShowFileName=.t.)}
    {text=16vOpt}: [%p=ui_get_file("Input Log Filename","Log(*.Log)|Text (*.txt)",Filename_Decode("[Logpath]")+"*.log","X");I=$a5_smart_file%.81vLogFilename!vLogFileNameEvent_*]
    {endregion22};
    {region23}
    {condition=ShowEdit=.t.}
    Log: [%mw%.40,18vLogFileText]{sp=2}
    {endregion23}
    %dlg%,<<%code%
    if a_dlg_button = "vOptEvent" then
        showfilename = .t.
        a_dlg_button = ""
    end if
    if left(a_dlg_button,18) = "vLogFileNameEvent_" then
        showFilename = .f.
        if a_dlg_button = "vLogFileNameEvent_popupdone" then
            vLogFileText = get_from_file(vLogFileName)
    [COLOR=#ff0000]'        showvar(vLogFileText)[/COLOR]
            select
                case Len(rtrim(vLogFileText)) = 0
                    ui_msg_box("Error:","File "+file.filename_parse(vLogFileName,"n")+" is Empty",UI_ATTENTION_SYMBOL)
                    ShowEdit = .f.
                    a_dlg_button = ""
                case left(vLogFiletext,1) <> "#"
                    ui_msg_box("Error: ","File "+file.filename_parse(vLogFileName,"n")+" has no Header",UI_ATTENTION_SYMBOL)
                    ShowEdit = .f.
                case else
                    ShowEdit =  if(vOpt="Edit Logging",.t.,.f.)
            end select
        end if
        a_dlg_button = ""
    end if
    %code%)
    Any suggestions welcomed.
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    #2
    Re: Why is this occuring?

    Hi Graham

    Code:
            vLogFileText = get_from_file(vLogFileName)
           ' showvar(vLogFileText)
           'Try - refresh the value
            vLogFileText = eval(" vLogFileText ")  'or   vLogFileText = replacement_parmeter( vLogFileText,local_variable() )
    and are you sure about this "popupdone" event name is a part of the function from A5?
    if a_dlg_button = "vLogFileNameEvent_popupdone" then
    Last edited by johnkoh; 12-06-2019, 07:10 AM.

    Comment


      #3
      Re: Why is this occuring?

      the crazy thing is that the same code works fine in a previous incarnation of my script! using popupdone (found this was only way of getting file. discovered it whilst using trace.writeln(a_dlg_button) to what was happening.
      I have since copied and pasted the code from the old script (where it worked) into the new, but still get the same result !!
      Last edited by Graham Wickens; 12-06-2019, 12:14 PM. Reason: aditional info
      --
      Support your local Search and Rescue Unit, Get Lost!

      www.westrowops.co.uk

      Comment


        #4
        Re: Why is this occuring?

        I tried your script with a text file that I added the '#' to and it worked fine with the showvar() commented out. I selected the Edit Logging option. The Input Logging option however didn't do anything when I selected the same file...
        Last edited by MoGrace; 12-06-2019, 02:07 PM.
        Robin

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

        Comment


          #5
          Re: Why is this occuring?

          Thanks Robin, "Input Logging" just loads the file and checks the header record, for processing later.

          Code:
          dim shared [COLOR="#FF0000"]vEditLogFileText[/COLOR] as c
          dim shared vLogFileName as c = "I:\my databases\aviation\logging\*.log"
          ui_dlg_box("test",<<%dlg%
           [%p=ui_get_file("Open Filename","Log(*.Log)",vLogFileName,"X");I=$a5_smart_file%.81vLogFilename!vLogFileNameEvent_*];
          Log: [%mw%.40,18vEditLogFileText]{sp=2}
          %dlg%,<<%code%
          if left(a_dlg_button,18) = "vLogFileNameEvent_" then
          	if a_dlg_button = "vLogFileNameEvent_popupdone" then
          		ShowFileName = .f.
          		[COLOR="#FF0000"]vEditLogFileText[/COLOR] = get_from_file(vLogFileName)
          		select
          			case len(rtrim([COLOR="#FF0000"]vEditLogFileText[/COLOR])) = 0
          				ui_msg_box("Error","File is Empty",UI_ATTENTION_SYMBOL)
          			case left(vEditLogFileText,1) <> "#"
          				ui_msg_box("Error","File has no Header",UI_ATTENTION_SYMBOL)
          		end select
          		showEdit = .t.
          		a_dlg_button = ""
          	end if
          	a_dlg_button = ""
          end if
          
          %code%)
          I changed the Variable name so that is only used in this section.
          I copied the relevant code from my main script as above, which as you found out works fine without the VarShow statement
          going to have a long lie-down in a dark room :)
          --
          Support your local Search and Rescue Unit, Get Lost!

          www.westrowops.co.uk

          Comment


            #6
            Re: Why is this occuring?

            This gets weirder and weirder!!

            I have split the "Edit Logging" and "Input Logging" into separate code. so you can forget "Input Logging", works just fine.

            Code:
            if left(a_dlg_button,19) = "vEditFileNameEvent_" then
            	showEditFileName = .f.
            	if a_dlg_button = "vEditFileNameEvent_popupdone" then
            		vEditFileText = get_from_file(vEditFileName)
            		[COLOR="#FF0000"]trace.writeln(vEditFileText)[/COLOR]
            		ShowEdit = .t.
            	end if
            	a_dlg_button = ""
            end if
            the file is still displayed as empty, BUT, the trace write displays correct data ????????????????
            --
            Support your local Search and Rescue Unit, Get Lost!

            www.westrowops.co.uk

            Comment


              #7
              Re: Why is this occuring?

              Not to be a smart aleck - but did you check the .log file in explorer? Maybe you can add _log to the name and give it a .txt extension instead...
              Robin

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

              Comment


                #8
                Re: Why is this occuring?

                yes, tried it with .txt and same result. The same file used in the "Input Filename" displays the correct data when processed !!
                --
                Support your local Search and Rescue Unit, Get Lost!

                www.westrowops.co.uk

                Comment


                  #9
                  Re: Why is this occuring?

                  Do you want to see the file displayed when vOpt=Input Logging and the case else statement is triggered?

                  Because this statement won't do that since it will always be false:

                  ShowEdit = if(vOpt="Edit Logging",.t.,.f.)
                  Robin

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

                  Comment


                    #10
                    Re: Why is this occuring?

                    I have rewritten this event removing any outside references. The "Input Filename" now has its own event which seems to work, so will leave that alone.

                    all I have left is this

                    in the dialog

                    Code:
                    Edit:  [%p=ui_get_file("Edit Filename","Log(*.Log)",vEditLogFileName,"X");I=$a5_smart_file%.81vEditLogFilename!vEditLogFileNameEvent_*];
                    
                    Log: [%mw%.40,18vEditLogFileText]
                    in the code

                    Code:
                    if left(a_dlg_button,22) = "vEditLogFileNameEvent_" then
                    	if a_dlg_button = "vEditLogFileNameEvent_popupdone" then
                    		vEditLogFileText = get_from_file(vEditLogFileName)
                    		a5_show_variable(vEditLogFileText,"vEditLogFileText")
                    	end if
                    	a_dlg_button = ""
                    end if
                    presumably, I have to leave the a5_show_variable in place, to allow the script to run, as I cannot see any other way around it, given my limited experience with xdialog.
                    Last edited by Graham Wickens; 12-08-2019, 06:23 PM. Reason: additional info
                    --
                    Support your local Search and Rescue Unit, Get Lost!

                    www.westrowops.co.uk

                    Comment


                      #11
                      Re: Why is this occuring?

                      it could of course be caused somewhere else in the script, but the only references to the edit file are as above !!
                      This is crazy, as it has taken me eleven months to get to a nearly finished script. I have learnt and used all sorts of methods and functions to make the thing work, but not something as simple as this .
                      --
                      Support your local Search and Rescue Unit, Get Lost!

                      www.westrowops.co.uk

                      Comment


                        #12
                        Re: Why is this occuring?

                        even more confusing, below is code from an early version (that works using same test file).

                        Code:
                        if left(a_dlg_button,18) = "vLogFileNameEvent_" then
                        	if a_dlg_button = "vLogFileNameEvent_popupdone" then
                        		ShowFileName = .f.
                        		vLogFileText = ""
                        		vLogFileText = get_from_file(vLogFileName)
                        		select
                        			case  len(rtrim(vLogFiletext)) = 0
                        				ui_msg_box("Error","File is Empty",UI_ATTENTION_SYMBOL)
                        				a_dlg_button = ""
                        			case left(vLogFiletext,1) <> "#"
                        				ui_msg_box("Error","File has no Header",UI_ATTENTION_SYMBOL)
                        				a_dlg_button = ""
                        		end select
                        		a_dlg_button = ""
                        		ShowEdit = if(vOpt="Edit Logging",.t.,.f.)
                        	end if
                        	a_dlg_button = ""
                        end if
                        --
                        Support your local Search and Rescue Unit, Get Lost!

                        www.westrowops.co.uk

                        Comment


                          #13
                          Re: Why is this occuring?

                          Graham,

                          You have applied
                          Code:
                          [%p=ui_get_file("Input Log Filename","Log(*.Log)|Text (*.txt)",[COLOR="#FF0000"]Filename_Decode[/COLOR]("[Logpath]")+"*.log","X");I=$a5_smart_file%.81vLogFilename!vLogFileNameEvent_*]
                          and I am not sure you can apply it(Filename_Decode( ) with UI_get_file() or not.

                          See my code and is it what you want?

                          Code:
                          dim defdir as C = "Z:\Temporary"
                          
                          dlg_title="Open folder"
                          ui_dlg_box(dlg_title,<<%dlg%
                          {region}
                          The next three smart fields are "user defined" smart fields.;
                          {endregion};
                          {region}
                          open folder:| [%p=ui_get_file("Enter file Path"," ",defdir +"\*.*");I=$a5_folder%.81vLogFilename!vLogFileNameEvent_Graham];
                          no event:| [%p=ui_get_file("Enter file Path"," ",defdir +"\*.*");I=$a5_folder%.81vTestFilename];
                          {endregion};
                          <*15&OK>;
                          %dlg%,<<%code%
                          
                          'if left(a_dlg_button,18) = "vLogFileNameEvent_" then  'this event is called from " !vLogFileNameEvent_* " then I assumed A5function code is looking for their own coding
                          	'if a_dlg_button = "vLogFileNameEvent_popupdone" then			'this event will not work - A5 may not recognized
                          '    if a_dlg_button = "vLogFileNameEvent_change" then 		    'see event name from help, there are few other event name
                                  'vLogFileText = get_from_file(vLogFileName)				'what is this "Get_from_file()"?
                                  '
                          
                          if a_dlg_button = "vLogFileNameEvent_Graham" then	'this event is custom(?) and nothing to do with A5function code
                          	
                          	
                          		if alltrim(vLogFilename) <> "" then
                          			'showvar(vLogFilename)
                          			ui_msg_box("test: ","File name is "+file.filename_parse(vLogFileName,"n"),UI_ATTENTION_SYMBOL)
                          		else
                          			msgbox("canceled ")
                          		end if
                          
                           	a_dlg_button = ""
                          else if a_dlg_button ="&OK"
                          	ui_msg_box("test: ","File name is "+file.filename_parse(vLogFileName,"n"),UI_ATTENTION_SYMBOL)
                          	
                          	'test no event case
                          	ui_msg_box("test no evenet: ","File name is "+file.filename_parse(vTestFileName,"n"),UI_ATTENTION_SYMBOL)
                          	a_dlg_button = ""
                          end if
                          
                          %code%)	
                          
                          
                          end

                          Comment


                            #14
                            Re: Why is this occuring?

                            Thanks John,
                            will have a look.

                            Ive been using the "popupdone" event for months and it works every time!!!

                            "Get_From_file" is an A5 function

                            GET_FROM_FILE()

                            Syntax

                            Data_String as C = GET_FROM_FILE( Filename as C )

                            Argument
                            Description

                            Filename
                            The fully qualified name of a file.


                            Description

                            GET_FROM_FILE() opens a file specified by filename and reads the contents of the file. Returns a character string with the contents of the file. This high level command is easier than using the low level FILE.OPEN()and <FILE>.READ()methods.

                            Supported By

                            Alpha Five Version 5 and Above

                            Example

                            This script sets the value in a variable to the contents of a text file.

                            dim text1 as C
                            Filename = "f:\a5\test2.txt"
                            Text1 = get_from_file(filename)
                            dim text1 as C
                            Filename = "f:\a5\test2.txt"
                            Text1 = get_from_file(filename)

                            See Also

                            File Functions and Methods, Directory Functions, Save_TO_FILE()


                            --------------------------------------------------------------------------------


                            The original document is available at http://wiki.alphasoftware.com/GET_FROM_FILE+Function
                            --
                            Support your local Search and Rescue Unit, Get Lost!

                            www.westrowops.co.uk

                            Comment


                              #15
                              Re: Why is this occuring?

                              Thanks

                              Comment

                              Working...
                              X