I am ultimately trying to convert a sql server table with xy values to multiple point feature classes based on the values in one of the fields in the table. Some of the values in the field are acronyms such as CCTV, but some are two or three word names like Freeway Ramp Meters. I do not edit the sql table so cannot control what the values are. If I run a model using XYtable to Point and then separating the points using Feature Class to Feature Class with an expression for each specific individual value, it works fine.
I want to iterate the process in case new values are added without me knowing. I set up a model with iterate field values that has the feature class to feature class run with %Value% in the selection expression and as the Output feature name. If I run the model it doesn't work with the multiple word values. I've run it with calculate field values, using .replace() to take out the spaces between the words. with %Value% in the selection expression and as the Output feature name. This runs fine but the output has no spaces. If I change the output to the original field value as the output name as %Field Name% This doesn't work. I need to have the values with the separate words at the end as we are using these feature classes in multiple maps and can't change the alias in all to multiple words. I can't make the output table an in-line variable that has spaces in it.
I've also tried iterating field values with: XY Table to Point, select layer by attribute %Value% and Copy Features. And iterating the original sql table, Table to Table to geodatabase table, and then XY Table to Point with %Value% as expression. Same problem.
I hope that's clear and sorry it's long.
Have you considered passing the whole SQL Server table, or a point dataset from the whole table to the Split By Attributes tool? That may be easier, even if you need to do some renaming/copying of the results.