Jump to content

Trim file name in create resource rule


bduncan

Recommended Posts

We're trying to use a create resource rule but the problem is the data supplied only represents the first 4-6 characters of the file name. Looking to trim the file name from "_" on to the right, add ".tif" and compose. Ex. Data field = "N5174" filename = "N5174_CA_1.25x1.462.tif". Can't trim specific # of characters as some names are 4 char. some 5. some 6. Need to use a delimiter function I suspect.

 

OS 10.5

FP 6

Link to comment
Share on other sites

We're trying to use a create resource rule but the problem is the data supplied only represents the first 4-6 characters of the file name. Looking to trim the file name from "_" on to the right, add ".tif" and compose. Ex. Data field = "N5174" filename = "N5174_CA_1.25x1.462.tif". Can't trim specific # of characters as some names are 4 char. some 5. some 6. Need to use a delimiter function I suspect.

I don't understand. If the field value is simply "N5174", then can't you just do something like this?

return CreateResouce(Field("MyFieldName") + "_CA_1.25x1.462.tif");

What exactly do you need to trim?

Link to comment
Share on other sites

The "_CA_1.25x1.462.tif" is not the same on the file names. It varies dramatically in character length from this to "_TN_1.tif" and hundreds of others.

Okay, but I'm still not understanding the pattern. Can you maybe provide a small list of field values and the corresponding file names?

Link to comment
Share on other sites

field values,filenames

2255,2255_NY_1.25.tif

N5035,N5035_AL_1.25x1.462.tif

NP5325,NP5325_TX_1.25.tif

S5926,S5926_MA_1_25x1_462.tif

 

Thanks for quick response. I really dig your sig! (I had to paste into FP to decode)

Link to comment
Share on other sites

field values,filenames

2255,2255_NY_1.25.tif

N5035,N5035_AL_1.25x1.462.tif

NP5325,NP5325_TX_1.25.tif

S5926,S5926_MA_1_25x1_462.tif

I still don't see any pattern here. I thought that your original question

Looking to trim the file name from "_" on to the right, add ".tif" and compose.

was about trimming something from the field value to get the file name. But unless the field values are something like "S5926_MA_1_25x1_462" and the file names are something like "S5926.tif", then your problem is actually the opposite: you need to add something to the field value to get the file name. It also looks like you need some other information to determine whether to add some kind of two-letter state identifier and some kind of size numbers as well, but I don't see where those come from in the data. Are there other fields which contain that data?

 

If there's just a simple one-to-one mapping of the field values to the graphic files, then I would add the graphics as named resources (in the Resources dialog), and then create a Switch Wizard rule to map them. Take a look at the Photo rule in the Frodo Travel Tutorial for an example.

 

Or, you can use the Resources dialog to name the graphic resources to match up exactly with the field values; then you can simply set the type of the field to Graphic in the Fields dialog and assign the field name to the graphic frame.

 

Or just rename the graphic files themselves to be 2255.tif, N5035.tif, etc.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...