Change Data Type size in a formula
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Please tell me how I can change the 74 to an 89. My output is being truncated by 15 characters. Is this the correct place to do this in a macro?
thanks,
Chris
Solved! Go to Solution.
- Labels:
- Data Investigation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Chris,
Looks to me like the issue is you are taking Field_1 and modifying it. Problem is, you cannot modify the size or type of an UPSTREAM ALREADY EXISTING field in a formula tool. Only in a tool with select functionality (select, Join, Multijoin, etc.).
What I do in these situations is to create a new field, maybe called "Field_1_modified", and there you can adjust your size and type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Mr. Barone,
Can I make that adjustment here? I should have highlighted the SELECT tool, not the Union tool.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, but it has to be before the formula tool or else the formula will still truncate. Looks like you have it after the formula tool.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Mr. Barone,
See screen shot below. I went into the Input Data Options to File/Field Layout and clicked the ellipses. This opens the Flat File Layout dialog box. I then edited the Record Length there. I now the get the expected output.
Thank you for the guidance.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, that is an option, but it is very sensitive to the input file. If you are sure none of the fields will change from run-to-run, then that should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, the format and layout is consistent from file to file. Only the number of rows of data would change.
Thanks again for your direction.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
As an FYI, you can change the data type and/or size of a field with just a single tool using the 'Multifield formula tool', which does not have to work on multiple fields.
Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
While not precisely answering your question (I'm not using a formula tool), there are a couple of other options that you have.
If you have a file layout (metadata) that has your field list with type and size, you can use the CREW "Dynamic Metadata" macro. If you don't have a file layout, you can create one (and edit it) with the Field Info and Formula tools:
Dynamic Metadata
If you have a sample file that has the structure that you want to use, you can pull that file's structure and use a Union tool to 'force' the structure on your data file. The trick here is that your 'structure' file must be the first connection into the Union.
Union Tool
