Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Change Data Type size in a formula

Archaeopteryx
10 - Fireball

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

changingOutputSize.png

8 REPLIES 8
mbarone
16 - Nebula
16 - Nebula

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.

Archaeopteryx
10 - Fireball

Hi Mr. Barone,

 

Can I make that adjustment here? I should have highlighted the SELECT tool, not the Union tool. 

 

adjustDataTypeLength.png

mbarone
16 - Nebula
16 - Nebula

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.  

Archaeopteryx
10 - Fireball

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. 

 

adjustDataTypeLength.png

 

Thank you for the guidance. 

Chris

 

mbarone
16 - Nebula
16 - Nebula

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.

Archaeopteryx
10 - Fireball

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

BenMoss
ACE Emeritus
ACE Emeritus

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

tom_montpool
12 - Quasar

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 MetadataDynamic 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 ToolUnion Tool

Labels