Visual Builder

Get Involved. Join the Conversation.

Topic

    Cesar Tepetla Corte
    How does Visual Builder define the line break when reading a...
    Topic posted July 17, 2019 by Cesar Tepetla CorteBronze Medal: 1,250+ Points, tagged Action Flows, Business Objects, Custom Code, JET, Process, REST, Services, UI, Web 
    44 Views, 4 Comments
    Title:
    How does Visual Builder define the line break when reading a file using File Picker?
    Summary:
    I need to separate a text line by line in sql pl
    Content:

    Hi everyone,

    I have a development in Visual Builder that reads .csv files using file picker.

    On the other hand, I have an apex web service that points to a package where it has all the contents of the file as input parameter and in that package I separate the lines and then in each line the fields delimited by commas are separated to separate each line in the package I put as an identifier "\r\n" assuming I had an entry like this example:
    "it's, a, test\r\nusing, file, picker\ r\n"
    this in order to insert each line and their respective fields in a database I tested this web service and it does not work until I change \r\n by \\r\\n and I tested the web service from the Visual Builder screen and it will not work either, will it be that I am not recognizing the delimiters of each line correctly? Or does Visual Builder handle them in a different way?

    Comment

     

    • Duncan Mills

      Once you start reading the text file it's nothing to do with Visual Builder, you are just using the HTML File APIs. Here's a good starting point:

      https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications

       

       

      • Cesar Tepetla Corte

        Hi Duncan,

        Thank you for your comment, I think it does not express my problem well, I have managed to read the file the problem is when I want to pass content from the file to the web service passes the string as empty, however when I use OIC to connect the VB screen with the service Rest I try to use the content is passed correctly and the package runs correctly and what I try to avoid is to use OIC because I can already create a REST service for the package I want to run on that screen...

        • Shay Shmeltzer

          How did you define the variable in VB that you are passing to the REST end point?

          Check in the browser's console to see that the variable that you are passing has the correct data in it.

          Is there any difference between the REST call that VB generates and one you do from postman?

          Some debugging tips here:

          https://blogs.oracle.com/vbcs/debugging-and-troubleshooting-visual-builder-logic

           

          • Cesar Tepetla Corte

            Hi Shay,

            I have created a variable of type Object that contains a variable of type string.

            In the browser console the request payload is displayed correctly:
            {"File_content" "UNIT, PERIOD, COMPANY, ID_ORGANIZACION, ID_LIBRO_CONTABLE, ID_PERSONA_REG, NUMERO_EMPLEADO_REG, ID_PERSONA_DIS, NUMERO_EMPLEADO_DIS, ID_PERSONA_SUP, NUMERO_EMPLEADO_SUP, ID_PERSONA_GTE, NUMERO_EMPLEADO_GTE, NUMERO_EMPLEADO_CHEFF_GTE, COMMENTS, TIPO_SUPERVISOR, CREATED_BY, LAST_UPDATED_BY, CREATION_DATE, LAST_UPDATE_DATE, ID_PERSONA_CHEFF_GTE \ r \ n0101, May-15,2525,300000001698016,78563,300000002861315,22,4855, e4730,155, e855,455,255,7525, None, P ,,, 17-JUN-19 09.06.30.000000 PM ,, 1525 \ r \ n "}

            Nothing has been different between postman and VB what is more curious than with OIC if it works correctly