Announcement

Collapse
No announcement yet.

[SOLVED] How to get user input and assign to global variable

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

  • [SOLVED] How to get user input and assign to global variable

    Hello,
    I want to upload a csv file to a table in mysql (using the LOAD DATA INFILE) but we must not burn the filename in code. We must prompt the user of the application for a filename and then assign it to a global variable for later execution of the sql sentence using this value provided. How can I prompt user for this (like an inputbox) value? I tried using the global variable as an IN in the application but just get prompted in development environment, once I get to production it does not prompt for the variable value.

    Thank you,

  • #2
    That prompt is for debug only. Most easy way is to create a small (control) app, add the necessary fields and store the value in the global variable. When you need this info you do a sc_redir to this app, after input of the user you do a sc_redir back. If you want to make this function common usable you need a global 'returnto' variable to let the app know where to jump (back) to.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      OK Thank you. I will explore that option. The other alternative if we are not going to prompt for user input I was thinking about is upload the csv file to a table (the contents of the file store it as a LONGTEXT -CLOB-) and then read that field and insert those lines to the table we want to load but in that case I figure we cannot use LOAD DATA since it will not be a file but a CLOB object.

      Comment


      • #4
        The control application and redirection worked great. Thanks for the help.

        Comment


        • #5
          I have a control app that we are entering a single value in and setting it equal to a global var. Then I have a grid linked through a button. There are 6 variables in all and all but the newly entered value make it to the grid. The last var is blank.

          Comment

          Working...
          X