Concatenate two fields in the same table.

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
I am trying to make a unique number to use in a comparison project. To do this, I need to concatenate two fields that are already in my table. Both fields are Text field types.

This is what I have now, but it is cutting the concatenation off. 

ToText([Tax ID]) &Right(ToText([Tax Number]),100)

 
Photo of Kallie Goodwin

Kallie Goodwin

  • 120 Points 100 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
Try just a List formula:

List("-", [Tax ID], [Tax Number])

It makes it easier to control. 

May I ask why you wanted to take the last 100 characters?
Photo of Kallie Goodwin

Kallie Goodwin

  • 120 Points 100 badge 2x thumb
Thanks for the recommendation. 

The 100 last characters was just me troubleshooting why it wasn't working. 

The formula you suggested is only taking part of the tax ID and none of the tax number, i.e.: 
Tax ID: 00-783-000-000
Tax  Number: 547
The result is only giving me 783 

Or
Tax ID: 11720-000-000
Tax Number: 5698
The result: 11720 

How do I make it print the entire two sets of data? Regardless of the leading or ending 0's?

I should add, the formula field type I have selected is Numeric, but my two fields I am trying to concatenate are text. Does that make a difference? 
(Edited)
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb
You may have discovered this by now, but the formula has to be text to incorporate the hyphens.
Photo of Kallie Goodwin

Kallie Goodwin

  • 120 Points 100 badge 2x thumb
Yes, I did figure that out. 

My problem now is that I need to remove those "-". Any ideas? 
Photo of Matthew Neil

Matthew Neil

  • 31,198 Points 20k badge 2x thumb
I haven't tested this, but you will need to use a combination of 
Right, NotRight and Left formulas to pull out the parts. 
Then combine back together.

var text Left=Left([Tax ID], "-");
var text Right=Right([Tax ID], "-");
var text Middle=Left(NotRight([Tax ID], "-"), "-");

$Left & $Middle & $Right 

Does that logic make sense?