csv file upload with fileUploader

Tagged:
  • Klaus79
        4 years ago #18600

        How can a csv file uploaded by user using fileUploader being processed?

        Documentation is too short.
        The user should be able to upload customizing based on a csv file.
        How do I export csv-file to connector as input?
        The Simplifier documentation states

        “Path
        Filepath and Filename to local .CSV File that should be written, relative to the current working directory of the application server. It is recommended to give an absolute path, so it doesn’t matter which directory is set as “Current Working Directory” from the app server start script.
        If you want to provide the files by the Html5 uploader you have to specify the path to the uploads directory. By default the path to the upload directory is
        /opt/simplifier/data/storage/uploads. ”

         

        But this is only the path (is this currently the right one)?
        How do I read in the correct, previously uploaded file (and not an old one or a file from another user).

        Concept is not clear.

        I link a business object method to the FileUploader-Event “uploadComplete”. In that Business object I call the csv connector.

        But with which file?

        A short example would be great.

        Mathieu Roll
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
          4 years ago #18698
          Up
          1
          Down
          ::

          Hello Klaus,

          here you can find an example application wich is exporting and importing a csv file into a table.

          https://files.simplifier.io/f/da2ca5a2255d45fea698/?dl=1

          jonas.rausch
              Has successfully completed the online course Introduction
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Advanced (300)
            4 years ago #18601
            Up
            0
            Down
            ::

            Hi,

            Could you elaborate further what you want to do with the data?

            Depending on the Use Case, there are different approaches to the issue.

             

            In general, .CSV files are just text files which can be processed as such.

            You can get the File object form the Uploader widget.

             

             

            Klaus79
                4 years ago #18604
                Up
                0
                Down
                ::

                it includes customizing data which will be saved in mysql tables.

                jonas.rausch
                    Has successfully completed the online course Introduction
                    Has successfully completed the online course Intermediate (200)
                    Has successfully completed the online course Advanced (300)
                  4 years ago #18605
                  Up
                  0
                  Down
                  ::

                  So you want to write the contents of the csv file into some DB Table?

                  Klaus79
                      4 years ago #18606
                      Up
                      0
                      Down
                      ::

                      yes correct.

                      I link a business object method to the FileUploader-Event “uploadComplete” (in ProcessDesginer). In that Business object I call the csv connector which writes data to db table.

                       

                      Klaus79
                          4 years ago #19461
                          Up
                          0
                          Down
                          ::

                          Thank you but example is not working because of missing mapping for export to csv in process designer.

                          Also in table I can’t edit data (because input field looses data when focus changes).

                          How do I get table data into global variable? There is no script step before calling client Business object  (in your example it exports an empty global variable).

                          Could you please update these information?

                          Klaus79
                              4 years ago #19462
                              Up
                              0
                              Down
                              ::

                              ok. Solved on my own.

                              In Process Designer mapping of items property of table is necessary (therefore you can do it without global variable)

                              and at least system library ‘FileSaver’ has to be included in app/module (otherwise function saveAs is not known).

                              Klaus79
                                  4 years ago #19530
                                  Up
                                  0
                                  Down
                                  ::

                                  unfortunatelly only download is working.

                                  FileUploader does not trigger any event.

                                  Any Information on that? I can’t see any errors in MS Edge debug mode

                                  Klaus79
                                      4 years ago #19619
                                      Up
                                      0
                                      Down
                                      ::

                                      solved myself: you’ve to set property ‘uploadOnChange’ in UI-Designer for immediately start of file upload or trigger upload event by calling method upload().

                                      Mehwish Farooq
                                          Has successfully completed the online course Introduction
                                          Has successfully completed the online course Intermediate (200)
                                          Has successfully completed the online course Basics (100)
                                        1 year ago #36539
                                        Up
                                        0
                                        Down
                                        ::

                                        I am stuck with csv file , I want to upload my file, read and update it on button click. I uploaded my csv file in app assets , created the connector and connector call as well but it still gives me error that csv file not found.

                                        Jennifer Häfner
                                            Has successfully completed the online course Intermediate (200)
                                            Has successfully completed the online course Advanced (300)
                                            Has successfully completed the online course Basics (100)
                                            Has successfully completed the online course Advanced (310)
                                            Has successfully completed the online course Advanced (320)
                                            Has successfully completed the Intermediate Certification
                                            Has successfully completed the Advanced Certification
                                          1 year ago #36553
                                          Up
                                          0
                                          Down
                                          ::

                                          Hi Mehwish,

                                          When you want to access a file that is uploaded in your application’s assets directory, you need to specify the following path in the CSV connector:

                                          /opt/simplifier/data/storage/appDirect/yourAppName/data/yourFileName.csv

                                          This path applies for a Simplifier standard installation. If your system has a different file structure, you have to ask your administrator where the assets of an application are stored.

                                          Mehwish Farooq
                                              Has successfully completed the online course Introduction
                                              Has successfully completed the online course Intermediate (200)
                                              Has successfully completed the online course Basics (100)
                                            1 year ago #36558
                                            Up
                                            0
                                            Down
                                            ::

                                            Hello Jennifer,

                                            Thankyou so much it worked for me that way but then i also had another write call when I test that it didn’t work as parameters I provided was data[0][0] and data[0][1] i am not sure what values should be given to this parameters and how to write body in order to test it, I made any mistake and now when I am testing my read connector call it’s not showing me any data as well maybe it over write or something I deleted connector calls and also upload file again but no luck so can you please tell me how to make both things work? I would be really gratefull.

                                            Jennifer Häfner
                                                Has successfully completed the online course Intermediate (200)
                                                Has successfully completed the online course Advanced (300)
                                                Has successfully completed the online course Basics (100)
                                                Has successfully completed the online course Advanced (310)
                                                Has successfully completed the online course Advanced (320)
                                                Has successfully completed the Intermediate Certification
                                                Has successfully completed the Advanced Certification
                                              1 year ago #36560
                                              Up
                                              0
                                              Down
                                              ::

                                              In the parameter ‘data’, you need a two-dimensional array with the first entry being the key (header) of the csv data, and the second being the values.

                                              For example: in your csv, you have data in the form ‘name’, ‘city’.

                                              name,city
                                              John,Washington
                                              Eva,Berlin
                                              Ben,London

                                              To write a new entry, you need to add all current values as well as the new values to the parameter ‘data’:

                                              [["name","city"],["John","Washington"],["Eva","Berlin"],["Ben","London"],["Tara","Stockholm"]]

                                              This will overwrite the file in the CSV connector, but you can still download the original file in your app’s assets section.

                                               

                                              If you want to export data from a table in csv/xslx format, you can use our new widget ‘TableEnhanced’ that we have just added to our Standard Content. This widget has an export button that automatically exports the visible table data as csv/xslx.

                                              Mehwish Farooq
                                                  Has successfully completed the online course Introduction
                                                  Has successfully completed the online course Intermediate (200)
                                                  Has successfully completed the online course Basics (100)
                                                1 year ago #36564
                                                Up
                                                0
                                                Down
                                                ::

                                                Hello !

                                                1)

                                                I have 5 columns and 10 row in my csv file can you please tell me how to write on it  ?as shown in the picture

                                                my column names are : FirstName,LastName,PhoneNumber,DateofBirth and Designation which contains 10 records.

                                                2)

                                                Also I want to edit it and add /delete more data from UI so i would be able o do it and export it via table enhancer widget?

                                                3)

                                                I am also facing difficulty in showing data from connector call to table can you brief me with that as well I would be really thankful. I created a button call a connector and then UI action but it’s giving me error

                                              Viewing 15 posts - 1 through 15 (of 15 total)

                                              You must be logged in to reply to this topic.