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

Grid Question

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

    Grid Question

    Hi everyone i have a script that i want to run on a Grid before the user starts to enter information into the grid, how would I do that? or maybe use a button. I cant figure out how to add the xbasic code to a button?

    Thanks in advance.
    Chad Brown

    #2
    Re: Grid Question

    I'm not clear enough on what you want to do to be sure what to suggest.

    A couple ideas maybe:

    Every .A5W page can have or call XBasic right on the page. But that runs when the page loads (generally speaking) so I dunno if that's what you want.

    Is it OK if the user presses a button before entering data? In which case, you could add a dialog component with an Advanced button onto the same page as your grid.

    I think we'll need a little more explanation to hit the nail squarely for you.
    -Steve
    sigpic

    Comment


      #3
      Re: Grid Question

      I want to have a page that when the user clicks an advanced button it runs a script. That script is an import function that I already have. After that script is run there is a field with a lookup which they can then select the record that they just imported and then the fields will be filled in. It wouldnt matter to me if it was a dialog or a grid. I just seems to be so much easier to use a grid. On submit it would then just redirect to itself. Or the page could call the script upon arrival to the page I tried this but it gave me a stack underflow error, and I am not sure what that means.

      Steve,
      I'm not sure if the import I have set up will look for the file located on the server, Its a mapped drive but maybe I have to change the import to look for it in the webroot directory. I am posting the import code for you all to have a quick peek.Thanks I hope this helps.

      'Date Created: 19-Dec-2008 12:24:23 PM
      'Last Updated: 19-Dec-2008 04:05:32 PM
      'Created By : Chad
      'Updated By : Chad
      'Prompt for a filename and store result in a variable called 'Activation'.
      dim prmpt_title as c
      dim prmpt_filter as c
      dim prmpt_default as c
      dim prmpt_flag as c

      prmpt_title = "Activation Number"
      prmpt_filter = "(*.txt)"
      prmpt_default = "S:\totals\*.txt"

      DIM SHARED Activation AS C

      'Activation = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")


      'Activation = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")
      temporary_import_table = file.temp_path_get()+ "actos_temp_table.dbf"

      import_destination_table = "actos"

      import_filename = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")
      if file.exists(import_filename) = .f. then

      ui_msg_box("Error","File to import not found: '"+import_filename+"'.",ui_stop_symbol)
      end
      end if

      ON ERROR GOTO ERROR19122008122434439


      import.type = 0
      import.names = "none"
      import.file = import_filename
      import.db = temporary_import_table
      import.skip_lines = 1
      import.skip_bytes = 0
      import.field_sep = ","
      import.record_sep = "<CR><LF>"
      import.text_qualifier = "\""
      import.record_len = 261
      import.rem_blanks = .F.
      import.escape_newlines = .F.
      import.import_encoding = "default"
      import.fields = 13
      import.field1 = "activation_number,n,1,8,0"
      import.field2 = "first_name,c,4,15,0"
      import.field3 = "last_name,c,6,15,0"
      import.field4 = "cell_number,c,8,10,0"
      import.field5 = "esn,c,9,14,0"
      import.field6 = "term,c,13,2,0"
      import.field7 = "rate_plan,c,14,12,0"
      import.field8 = "field_16,c,15,1,0"
      import.field9 = "field_17,c,16,9,0"
      import.field10 = "field_18,c,17,6,0"
      import.field11 = "field_19,c,18,6,0"
      import.field12 = "field_20,c,19,7,0"
      import.field13 = "field_21,c,20,9,0"
      import()

      a_tbl = table.open(import_destination_table)
      append.t_db = temporary_import_table
      append.m_key = "ACTIVATION_NUMBER"
      append.t_key = "ACTIVATION_NUMBER"
      append.m_filter = ""
      append.t_filter = ""
      append.type = "unique only"
      append.m_count = 13
      append.m_field1 = "ACTIVATION_NUMBER"
      append.m_exp1 = "@actos_temp_table->ACTIVATION_NUMBER"
      append.m_field2 = "FIRST_NAME"
      append.m_exp2 = "@actos_temp_table->FIRST_NAME"
      append.m_field3 = "LAST_NAME"
      append.m_exp3 = "@actos_temp_table->LAST_NAME"
      append.m_field4 = "CELL_NUMBER"
      append.m_exp4 = "@actos_temp_table->CELL_NUMBER"
      append.m_field5 = "ESN"
      append.m_exp5 = "@actos_temp_table->ESN"
      append.m_field6 = "TERM"
      append.m_exp6 = "@actos_temp_table->TERM"
      append.m_field7 = "RATE_PLAN"
      append.m_exp7 = "@actos_temp_table->RATE_PLAN"
      append.m_field8 = "FIELD_16"
      append.m_exp8 = "@actos_temp_table->FIELD_16"
      append.m_field9 = "FIELD_17"
      append.m_exp9 = "@actos_temp_table->FIELD_17"
      append.m_field10 = "FIELD_18"
      append.m_exp10 = "@actos_temp_table->FIELD_18"
      append.m_field11 = "FIELD_19"
      append.m_exp11 = "@actos_temp_table->FIELD_19"
      append.m_field12 = "FIELD_20"
      append.m_exp12 = "@actos_temp_table->FIELD_20"
      append.m_field13 = "FIELD_21"
      append.m_exp13 = "@actos_temp_table->FIELD_21"
      append.t_count = 0
      a_tbl.append()


      GOTO CONTINUE19122008122434439
      ERROR19122008122434439:
      ON ERROR GOTO 0
      ui_msg_box("Error","Error running Import Operation"+crlf()+error_text_get())
      END
      CONTINUE19122008122434439:

      a_tbl.close()

      'In case the destination table is not already in the Database, add it...
      file_add_to_db(table.filename_get(import_destination_table))
      'If the Operation is run from within a Form or Browse, then refresh the window
      if is_object(topparent.this) then



      end if

      'Date Created: 19-Dec-2008 12:24:23 PM
      'Last Updated: 19-Dec-2008 03:27:43 PM
      'Created By : Chad
      'Updated By : Chad
      'Prompt for a filename and store result in a variable called 'Activation'.
      dim prmpt_title as c
      dim prmpt_filter as c
      dim prmpt_default as c
      dim prmpt_flag as c

      prmpt_title = "Activation Number"
      prmpt_filter = "(*.txt)"
      prmpt_default = "S:\totals\*.txt"

      DIM SHARED Activation AS C

      'Activation = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")


      'Activation = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")
      temporary_import_table = file.temp_path_get()+ "actos2_temp_table.dbf"

      import_destination_table = "actos2"

      import_filename = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")
      if file.exists(import_filename) = .f. then

      ui_msg_box("Error","File to import not found: '"+import_filename+"'.",ui_stop_symbol)
      end
      end if

      ON ERROR GOTO ERROR19122008152428798


      import.type = 0
      import.names = "none"
      import.file = import_filename
      import.db = temporary_import_table
      import.skip_lines = 0
      import.skip_bytes = 0
      import.field_sep = ","
      import.record_sep = "<CR><LF>"
      import.text_qualifier = "\""
      import.record_len = 261
      import.rem_blanks = .F.
      import.escape_newlines = .F.
      import.import_encoding = "default"
      import.fields = 5
      import.field1 = "activation_number,n,1,8,0"
      import.field2 = "type,c,4,4,0"
      import.field3 = "date,c,5,8,0"
      import.field4 = "dealercode,c,8,10,0"
      import.field5 = "employee_number,n,9,15,0"
      import()


      a_tbl = table.open(import_destination_table)
      append.t_db = temporary_import_table
      append.m_key = "ACTIVATION_NUMBER"
      append.t_key = "ACTIVATION_NUMBER"
      append.m_filter = ""
      append.t_filter = ""
      append.type = "Unique only"
      append.m_count = 5
      append.m_field1 = "ACTIVATION_NUMBER"
      append.m_exp1 = "@actos2_temp_table->ACTIVATION_NUMBER"
      append.m_field2 = "TYPE"
      append.m_exp2 = "@actos2_temp_table->TYPE"
      append.m_field3 = "DATE"
      append.m_exp3 = "@actos2_temp_table->DATE"
      append.m_field4 = "DEALERCODE"
      append.m_exp4 = "@actos2_temp_table->DEALERCODE"
      append.m_field5 = "EMPLOYEE_NUMBER"
      append.m_exp5 = "@actos2_temp_table->EMPLOYEE_NUMBER"
      append.t_count = 0
      a_tbl.append()


      GOTO CONTINUE19122008152428798
      ERROR19122008152428798:
      ON ERROR GOTO 0
      ui_msg_box("Error","Error running Import Operation"+crlf()+error_text_get())
      END
      CONTINUE19122008152428798:

      a_tbl.close()

      'In case the destination table is not already in the Database, add it...
      file_add_to_db(table.filename_get(import_destination_table))
      'If the Operation is run from within a Form or Browse, then refresh the window
      if is_object(topparent.this) then
      if topparent.Class() = "form" .or. topparent.class() = "browse" then
      topparent.Refresh_layout()
      end if
      end if
      Chad Brown

      Comment


        #4
        Re: Grid Question

        I did not read through the entire script, but you have to change your approach. You cannot use ANY function that calls a dialog, such as the UI_...() functions. Most likely you would start out with a Dialog, not a grid. Ask your questions in the Dialog, use the AfterValidate event to do whatever your script does.

        If you are trying to import a file from the users computer to a database on your server, you can't. You first have to UPLOAD any file (or use FTP, or other functions, but you cannot "import".). That and all the "topparent" references have to go, there isn't any parent. Review each of the functions you use in the Help documentation and confirm they can be used on the web.
        Steve Wood
        See my profile on IADN

        Comment


          #5
          Re: Grid Question

          Thanks Steve for the post, the import file is already on the server through another program so there is no upload needed. My original thought was to do a straight import but from your earlier post I realize thats not going to happen and its easy for me to get the files put on the server being that they are such a small file.

          Steve did you get my private message in regards to working on this and some other stuff for me or are you to busy?
          Chad Brown

          Comment

          Working...
          X