Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dynamically Placed Variables

Community Beginner ,
Jan 11, 2018 Jan 11, 2018

I'm trying to figure out if there's a way to dynamically place elements based on the length of a variable text string. I have a few images that I'm creating with variables where there are two text strings centered and stacked. Those are all working perfectly because nothing on the image needs to move in relation to other variable data. The third image I'm working on has a text variable (that varies quite a bit in character length), a graphic element (not a variable) to the right of it, and then another text variable. I'm trying to figure out if there's a way to move the graphic element to the right of the first text variable based on what data is inputted (e.g. if the variable text string is 3 characters the graphic element should be say, 20 px to the right but if the variable text string is 15 characters, the graphic element should still be 20 px to the right - but in a totally different position than the case of the 3 character text string). 

3.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 16, 2018 Jan 16, 2018

If the graphic between the two varialbles must be variable (or something other than text), you can:

  • Create the left text variable as a right-aligned PointType object.
  • Create the right text variable as a left-aligned PointType object.
  • Position the graphic variable between them, spaced as desired.
  • Group the three variables.
  • "Name" the group by selecting it and entering text in the Note field of the Attributes palette. (ex: "Group")

Then record an Action which:

  1. Invokes Next Data Set
  2. Selects Group
  3. Left align
...
Translate
Adobe
Community Expert ,
Jan 11, 2018 Jan 11, 2018

Which version of Illustrator are you using?

Can you provide a sample .ai file with detailed instructions? Or can you at least post some screenshots that may explain your task?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 11, 2018 Jan 11, 2018

I'm using CC 2018

variable.png

So I'm trying to figure out if there's a way to move the graphic element (in this case the blue bar) and the variable on the right, based on the character length of the text variable on the left which needs to stay left-aligned. So in one data set, I might have both "cat" and "Mississippi" - in the case of "cat" the blue bar and the second variable would need to move left to maintain the distance of the first variable to the blue bar and the second variable to the blue bar but in the case of "Mississippi" everything would have to move a bit to the right. I'm trying to do a batch export of a large number of files, all of which have variables that vary in character length. the character length of the second variable (on the right) doesn't matter because it's also left-aligned and there's nothing to the right of it. Does that make sense?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 12, 2018 Jan 12, 2018

Easiest way would be to pre-define a slot length say '30 characters' and just pad you variable (i.e. text 'string' with space characters concatenated with it)

Left = 'Left                         '

Right = '                     Right'

Just make an excel file or something that will pad in the extra spaces

'x' being a 'space'
'xxxxxxxxxxx' (full maximum length of your variables/list items)

put 'cat' in there...

'xxxxCATxxxx'

'CATxxxxxxxx'

'xxxxxxxxCAT'

variableshare.PNG

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 16, 2018 Jan 16, 2018

Thanks for your response. This doesn't seem to address moving the actual graphic element. What I'm trying to do is dynamically place the blue bar and the following text variable based on how long the first word is. Adding spaces in each variable I don't think would do anything to the static graphic element as the graphic element isn't part of the first text variable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2018 Jan 12, 2018

I wonder if you are always using plain elements like the blue rectangle or if you are going to use any kind of graphic symbol.

Also, is it just one text variable or two separate variables?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 16, 2018 Jan 16, 2018

well if its a predictable 'pattern' aka... a certain number range of possible numbers.. make group, label them by character length (15 is here, 10 is there)

then make some data to import.. have one of the columns be the 'length' .. which would correspond with the group name '10', '15'

Here's an article... you can make 'visibility' of groups/layers controlled by the data... 'turn on this one for this length.. etc)
Data-driven graphics through templates and variables in Illustrator
....
But if what your picture shows .. a generic blue bar ... type '|' ... color it blue then make red text and again pad with spaces.

they can now both appear to move based on the spaces idea from above.

xxxx | Variable

xxxxxxxxxxxxxxxxxxxx | Variable

Other than that I'd recommend taking better pictures of your idea for us to dissect.

Until then experimenting/testing is your best bet

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 16, 2018 Jan 16, 2018

The reason people are asking you for a more thorough description of the requirements is because the way you've described it so far suggests you could simply do it using regular typography if it's just a vertical bar and there's no reason why the whole string can't be in a single variable:

Cat | Mississippi

Mississippi | Cat

JET

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 16, 2018 Jan 16, 2018

If the graphic between the two varialbles must be variable (or something other than text), you can:

  • Create the left text variable as a right-aligned PointType object.
  • Create the right text variable as a left-aligned PointType object.
  • Position the graphic variable between them, spaced as desired.
  • Group the three variables.
  • "Name" the group by selecting it and entering text in the Note field of the Attributes palette. (ex: "Group")

Then record an Action which:

  1. Invokes Next Data Set
  2. Selects Group
  3. Left aligns Group to the left edge of the Artboard
  4. Moves Group rightward the required amount
  5. Deselects

Action_VariablePosition_1of3.PNG

Action_VariablePosition_2of3.PNG

Action_VariablePosition_3of3.PNG

JET

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2018 Jan 17, 2018

Oh interesting. I tried using an action to align things but didn't get it quite right. Your suggestion might work! Thank you. As to your previous response, the text is in separate variables because different data needs to go into each variable. This is for generating thousands of files so things like adding spaces based on the characters in a variable or trying to combine variables in a spreadsheet would be super time consuming. I'll try the alignment action as you suggest and let you know! Thanks for your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 17, 2018 Jan 17, 2018

padding data with spaces takes under a minute. (100 to 100,000,000 variables)
You need to start experimenting with workflows to see how things actually behave

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2018 Jan 17, 2018

This worked perfectly! Thanks so much for your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2018 Jan 17, 2018
LATEST

You're welcome. Just as follow-up:

…so things like adding spaces based on the characters in a variable or trying to combine variables in a spreadsheet would be super time consuming.

Just for the record, padding with spaces in a spreadsheet is not "super time consuming." It's practically instantaneous assuming you are using something capable of text calculations (FIleMaker Pro, Excel, etc.). But the very concept of using multiple consecutive spaces (or carriage returns) for spacing anything just makes me cringe, as a matter of designerly principle. 😉

As to your previous response, the text is in separate variables because different data needs to go into each variable.

That alone doesn't prevent your working with a single variable either, if the vertical bar can just be a text character. Surely you're not just using Illustrator as the data entry mechanism for thousands of records?

As with merely adding spaces by a text calculation, anything with text functions can automate the creation of a single text string from multiple data values. For example, suppose value of the left variable is to be EmployeeName, and the value of the right variable is Company. The first column of the spreadsheet would typically be EmployeeName. The second column would automatically populate from a one-to-many relationship. The third column could just be a text calc which combines the first and second column values separated by a vertical bar into one string. Just that third column would be exported for use as the values for a single variable in Illustrator.

Doing that wouldn't yield the different formatting for the bar character, but that could be done with Find and application of a Character Style, which also could be automated with an Action.

JET

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines