Discussions

Expand all | Collapse all

Highlighting a file with a specific naming convention

  • 1.  Highlighting a file with a specific naming convention

    Posted 03-29-2019 14:46
    I am trying to highlight a file that shows up in a report with a specific naming convention. 

    The naming convention is as follows: Store # - Project Type.pdf. So, an example PDF would look something like "0001-ROOF.pdf"

    I am not trying to just pull one project type. There are 130 types. So I need some way to dynamically refer to the Store # and Project Type fields.

    What kind of formula can I use to highlight files that follow this naming convention?


  • 2.  RE: Highlighting a file with a specific naming convention

    Posted 03-29-2019 14:57
    Can you explain what you mean by "highlight"  Are you looking to do Row Colorization or are you looking to have the text show up in yellow if it meets a certain format?


  • 3.  RE: Highlighting a file with a specific naming convention

    Posted 03-29-2019 15:00
    It would be row colorization when the naming convention is met.


  • 4.  RE: Highlighting a file with a specific naming convention

    Posted 03-29-2019 15:32
    I would suggest a formula checkbox to allow the records to self identify as needing to be checked. The formula could be a "If" statement checking the checkbox if whatever condition(s) you set on the file attachement field is true. Then just set row colorization in the report settings to color the row if your newly created checkbox is checked.


  • 5.  RE: Highlighting a file with a specific naming convention

    Posted 03-29-2019 16:24
    I think that Davis is looking for help with the actual syntax of the formula for if the file naming convention is valid.  i will have to find time to respond unless someone beats me to it.


  • 6.  RE: Highlighting a file with a specific naming convention

    Posted 03-29-2019 16:30
    Yes, this is what I'm looking for.


  • 7.  RE: Highlighting a file with a specific naming convention

    Posted 03-29-2019 16:46
    Not tested but try this.  I'm going to solve for flagging invalid file formats.


    // format should be "0001-ROOF.pdf"

    var text FileName = ToText([File Attachment]);

    var text ProjectNumber = Left($FileName,"-");
    var text ProjectType = Part($FileName, 2,"-");
    var text FileType = Right($FileName,".");

    IF(
    $ProjectNumber <> [Project Number]
    or
    $ProjectType <> [Project Type],
    or
    $FileType <> "pdf"), true)

    // I don't know what field type your Project Number is.
    // if its numeric then the formula would be



    IF(
    ToNumber($ProjectNumber) <> [Project Number]
    ......






  • 8.  RE: Highlighting a file with a specific naming convention

    Posted 03-29-2019 18:11
    Quick Base needs regex! Never thought I'd see the day.