Genie Discord forum

Author Avatarkrishnab
1/19/2023, 5:04:47 AM

Is there a widget or control in Stipple for selecting a file from a pop up window? I looked in the Genie builder list of widgets and did not see anything like that, but I might not be looking in the right place. I wanted the user to be able to choose a cab file to put into a data table .

Author Avatarkrishnab
1/19/2023, 5:33:38 AM

@kungfupanda007 Is Uploader function a widget or something that I can put on an app? I just looked at all of the Genie Builder blocks, but did not see an "uploader" widget. But is there a way to include this in the app anyway?

Author Avatarkrishnab
1/19/2023, 5:39:42 AM

Ahh got you. Okay will do. Thanks for the tip.

Author AvatarPere
1/19/2023, 8:09:23 AM

We have an uploader component, see the CSV uploader tutorial to learn how to use it

https://genieframework.com/blog/how-to-build-a-data-app-with-a-CSV-file-uploader/

Author Avatarkrishnab
1/19/2023, 5:05:09 PM

@Pere thanks for the link, I was just reading over it. Sorry, I am not much of a web page developer, so I have some basic questions. So if I want to adapt the code in the tutorial to work with a Genie Builder app, seems like I can put that code into the app.jl file--while the tutorial references the ui.jl file. So for Genie Builder I use the no-code tool to create the controls and place them on the UI. This tool then generates the HTML and I can refer to those components through the app.jl file. In the tutorial, seems like the components are placed through the ui.jl file, and not in the HTML. For example this code:

[
    heading("{{title}}")
    row([
        cell(class="col-md-12", [
            uploader(label="Upload Dataset", accpt=".csv", multiple=true, method="POST", url="http://localhost:8000/", field__name="csv_file")
        ])
    ])
] |> string

So is it more appropriate to actually create a "title and content" widget or a "selector" widget--which will place the control in the HTML, and then update the inline properties as in the code above? I just was not sure which widget/control to use.

Author AvatarPere
1/19/2023, 8:33:21 PM

In the tutorial we are using the low-code API. In this case we use app.jl for the app logic, and ui.jl to define the UI

Author AvatarPere
1/19/2023, 8:34:42 PM

If you use Genie Builder, then we can have app.jl for the logic and app.jl.html for the UI. The no-code editor writes HTML code to app.jl.html every time a new component is added to the canvas

Author AvatarPere
1/19/2023, 8:35:17 PM

In the no-code editor we are restricted to the available components, which unfortunately does not include the CSV uploader

Author AvatarPere
1/19/2023, 8:39:03 PM

Still, you can embed Julia code in html files with <% code %>, which will be executed and its return value rendered. For instance, to include an uploader you can add this to app.jl.html : <% uploader(label="Upload Dataset", accept=".csv", multiple=true, method="POST", url="http://localhost:8000/", field__name="csv_file") %>

Author Avatarkrishnab
1/19/2023, 8:41:10 PM

@Pere that is wonderful. Okay, I can give that a try and see what happens :).

Author AvatarPere
1/19/2023, 8:42:31 PM

we do the same in this tutorial to add a table

https://youtu.be/FQFD2YYqtpA?t=641

Author Avataritzi
8/22/2023, 12:47:01 PM

hello @Pere I was taking a look at this post because i also want to analyse data from CSV files that are uploaded into the GUI. When i add the julia lines to app.html and then edit again in app.jl.html and save the changes it overwrites all changes and the julia code i added disappears, what should i do? Have you found any other more efficient way to analyse data from different CSV files? Thank you. If you remember it happened to me when i wanted to add a table too.

Author AvatarPere
8/22/2023, 8:10:59 PM

That's strange @itzi , the Julia code should stay there. I have tried pasting the uploader code above into an existing page and it worked

Author AvatarPere
8/22/2023, 8:12:10 PM

See that the Julia code appears in the nocode editor, but it is rendered on the page. Did you click on the reload button after editing the HTML? Otherwise, if you edit the file and go back to the nocode without reloading, saving new changes will overwrite your edits to the HTML file

Author Avataritzi
8/23/2023, 6:53:47 AM

Thank you very much, I will try again! but the uploader does not work I am unable to load files because when i do there is a โš ๏ธ sign, is there a size limit? or is it because it does not work in the preview mode?

Author Avataritzi
8/23/2023, 7:56:48 AM

it really does not work, when i re save it the code just appears without rendering, and even to do that i had to save it stop the server and restart it then it worked for a bit and the moment i made a change and saved it it was gone again

Author Avataritzi
8/23/2023, 7:58:46 AM

my only solution is that the user copies the paths to folders manually ๐Ÿ˜… but if you have any other ideas

Author Avataritzi
8/23/2023, 8:05:58 AM

because when i save the html code changes

Author AvatarPere
8/23/2023, 3:39:07 PM

@Itzi could the issue issue be that in your HTML the <% %> delimiters are being replaced by &lt, and same for other characters like ". When the renderer loads the HTML it does not recognize the delimiters and hence it simply displays the text in the page. could it be because of some extension in your VSCode install?

Author Avataritzi
8/29/2023, 1:36:54 PM

hi @Pere this substitution happens when I save changes on top of the insert so i associate it with the saving of the no code editor because everything else works alright. Are you able to add components to the UI and save it or you have to add these inserts at the end?