Community

Preventing a field from extracting if empty

Is there a way to prevent a field from extracting in FlexiCapture if there is no extracted data. What I'm trying to do is to prevent even the field title from exporting in the CSV file.

The following:
Field1,Field2,Field3
ABC,,DEF

Would instead export this way:
Field1,Field3
ABC,DEF

Thank you

0

Comments

8 comments

  • Avatar
    Rahul Kapoor

    Yes, there is a way to implement this. You have to configure 2 export options in your document definition - One that will export all the fields and the other that will export all fields except that one.

     

    Then in first export setting, you have to put field condition to only export when than field is not empty. For 2nd export setting, the condition would be to only export when that field is empty. 


    Let me know if you face any issue in this.

    Regards,
    Rahul Kapoor
    www.linkedin.com/in/rahulkapoor309/

    0
  • Avatar
    Scott Chau

    Are you trying to make it dynamic or will you have only 2 export.  One where field2 will be empty or not?  If you only have 2 export, then you can create 2 export.  One where the export will be based on conditions.  So 1 export will have field2 when it has a value and one where field2 would not export when it has no value.

    If its dynamic where field1, field2, field3... could be empty, then you really need to create a script export.  You would have to programmatically create the export file based on field value.

    0
  • Avatar
    Gaetan Viau

    Thank you for your answer. Doing it dynamically is what I'm looking to do. So I could have 20 different fields in the layout and would only want to export the fields that contain a value.

    Would that be a script created at the field level? Could you help me out identifying what this script would need to be and let me know where the script needs to be included?

    Can the 'Export Field' option in FlexiCapture be handled with a script? That would certainly feel like the best option if this is possible.

    Thanks in advance.

    0
  • Avatar
    Scott Chau

    It would be an export script.  Look at the sample export script here

    Sample scripts describing export (abbyy.com)

     

    Basically check if the field has a value.  If so, use that for exporting.

    0
  • Avatar
    Gaetan Viau

    Rahul,

    I understand that we can set conditions to export only when a field has a value or not, and that could be an interesting option for a different project of mine, but I fail to see how it would apply to my current scenario considering we can't seem to be able to select the fields that are to be exported. The way I understand this, it says: 'Don't export the extraction if this field is empty/not empty.' It doesn't let us choose a subset of fields to include/exclude when that selected field is empty/not empty.

    Also, because the fields that could be empty change all the time, that option would not be viable. I need a dynamic way of handling this.

    Thank you for your support.

    0
  • Avatar
    Gaetan Viau

    Scott,

    Thanks for the link about export scripts. I am unsure where I would include these scripts though. Can you lead me in the right direction?

    I see this code gets the value of a field if there is a value, but where does this say that the field shouldn't be exported if there is no value?

    Dim field1Value, field2Value
    ' Gets the value of Field1 in Section 1
    if Not IsNull( me.Field( "Section 1\Field1" ).Value ) then
        field1Value = me.Field( "Section 1\Field1" ).Value
    end if

    Thanks in advance.

    0
  • Avatar
    Scott Chau

    Gaetan,

    Its an export script, so you need to create it for your export.  See screen shot below.  The code isn't exactly like what you want.  It gives you an idea.  Basically you would check that the field is not empty.  If its not empty, then you would script it to "WriteLine" to your csv file.

    0
  • Avatar
    Gaetan Viau

    Understood. Thanks for your time. Now I need to figure out what that script would be. LOL

    0

Please sign in to leave a comment.