How do I add validations on a csv file I am uploading to s3 using an S3uploader

  • Goal: wish to have some validations (regex based) on a csv file I am uploading using the s3 uploader component.

  • Steps: what i have done/tried so far
    created a javascript query which has the validations, will return a boolean value saying wether the file is valid or not
    tried adding the validator before the other steps of the s3 uploader, but it kept saying my validator is not defined and kept failing
    tried adding another upload to do the validations but this is feasible and not allowed by my higher ups.
    Need to find a way to run this script when the file is uploaded, if the file is valid will run the other steps and if not, will not run the other steps and upload orphan file onto s3

  • Details:Have a name and message field which is have length 5+ will enable the s3 uploader. Once uploaded a chain of events is triggered

  • Screenshots:

  • App json export: sensitive data, cant share

please ignore the s3uploader2 button, had made it to do some debugging

Hi @Muchukota_Shiva ,
Can you upload your json file without the sensitive data? A basic json export will not include anything in your database. If not, can you send me screenshots of your js queries for validations as well as how you are handling events? How and when are you running the validator? Are you using a success handler in your validator query to then run the s3 uploader?

If I understand what it is you are trying to accomplish, here is what I suggest you do:

  1. Within your validator query, if the file is valid, return TRUE. Otherwise, throw an error.
  2. Then in your Success handler in that query, run the steps you want to run if the file is valid, including the step to upload to S3.
  3. In the Failure handler, run the steps you want to run if the file is not valid, including the step to upload to S3.

Let me know if that helps.

hey really sorry for not replying sooner

It seems this wasn't possible so we found another way to go about this without changing our retool app

you can close this issue.
thank you for responding, good day!