+ Start a Discussion
Melissa GMelissa G 

Visual Workflow - Truncate at specific character


Quick question. I have two different custom objects, 'FTP File' and 'FTP File Configuration'. I need to calculate the last date the FTP file was received to determine if the file was late.

The name of an FTP file is contained within an FTP file configuration. For example, an FTP file configuration named ABC001234 will have associated files called ABC001234_11012017081530.ftp, ABC001234_11022017081929.ftp, and ABC001234_11032017080117.ftp.

Normally, once processed, an FTP file will have the name (lookup field) of the FTP file configuration filled in. However, depending on when the FTP file record is created, it could be blank. I am trying to setup a decision that will (lead to a) lookup and find the FTP file configuration record. In the condition for the lookup I am saying 'FTP configuration name contains the FTP file name'. However, because the FTP file name is longer than the FTP file configuration name, the condition is never met (ABC001234 does not contain ABC001234_11032017080117.ftp).

I was wondering if there is a way to truncate the FTP file name so that only the FTP file configuration name is used as part of the condition. The FTP file will always use the format [FTP File Config Name]_[date/time].ftp. If I could truncate the file name prior to the underscore I could use the contains or equal. I do not know how to do this, however. I saw some examples for using MID but the FTP file configuration names are not always the same length.

Does anyone have any suggestions? Is this a formula in the flow or something else?

Thanks so much for any help you can provide!

Gaurav HandooGaurav Handoo
Hi Melissa

Instead of using contains, you should use starts with for your decision element. This should match your search condition.

Let know if this works.