I have two fields that are year and month and are integers. I am trying to concatenate these two fields so they go display like 2020-01,2020-02, etc
i cannot figure out how to do this with tostring and padleft functions. i keep getting malformed function errors.
Solved! Go to Solution.
hi
You can change the data type of those two fields to strings and try this expression in the formula tool [year]+ "-"+[month].
hope this helps!
how do i get the zero to populate? i want it to read 2020-01 not 2020-1
@parria1 - check out the attached solution:
after you change the data types to strings use this PadLeft([month], 2, '0')
THIS GIVES ME A MALFORMED FUNCTION CALL
tostring([order_yr] + "-" + padleft(tostring([order_mth_num]),2,"0")
you are missing a ")"
tostring([order_yr]) + "-" + padleft(tostring([order_mth_num]),2,"0")
that should work