Toggle navigation
Home
▼ Details
Products and pricing
Chart gallery
User stories
Text analytics
CDC NAMCS Library
Blog
Tutorials
Contact
Sign in
Post Editor
← All help posts
View post
Save
If you have a group of child elements that need title text, you can programmatically copy titles over from a different group that has the same titles. In the example below Q15v2's child elements are missing title text that Q14v2's children already have. <img src="/uploads%2Fupload%2Fimage%2F5200%2Fdirect%2F1606967380681-1606967380681.png" alt="Two horizontal bar charts comparing "Q14v2" and "Q15v2" questions, both asking "What percent of your Condition X/Y patients receiving a GA (gamma antagonist) would receive" with "Compact to Mean" shown. Q14v2 lists products like "New XR Product B" (41.5), "Product D" (23.9), etc., while Q15v2 shows similar items labeled as "Q15v2_1" (36.1), "Q15v2_2" (23.0), etc." style="width: 675px;" class="fr-fic fr-dib"> The code below runs through an array and sets each element title by getting the title from a different element. This will only work if the child elements of both groups use a similar naming convention. \[1, 2, 3, 4, 5, 6, 7, 96\] is an array that lists each suffix for the child elements of the groups. In "function(c)" the **c** represents the array, and the function will run through each value in that array. ("**Q15v2\_**"+**c**).set represents the element that is missing the titles, and ("**Q14v2\_**"+**c**).get references the elements from which you will copy the titles. ## Code \[1, 2, 3, 4, 5, 6, 7, 96\].forEach(function(c){ protobi.getDimension("Q15v2\_"+c).set('title',protobi.getDimension("Q14v2\_"+c).get('title')) }) Open up the developer's console on your browser window and enter the example code above (edit to fit your specific case). Press enter on your keyboard to run the code. <img src="/uploads%2Fupload%2Fimage%2F5200%2Fdirect%2F1606967929266-1606967929266.png" alt="Protobi interface displaying browser developer console on the right side with JavaScript code visible: "[1, 2, 3, 4, 5, 6, 7, 96].forEach(function(c){ protobi.getDimension(\"Q15v2_\"+c).set('title',protobi.getDimension(\"Q14v2_\"+c).get('title'))})". The left side shows survey questions Q14v2 and Q15v2 with product comparison data." class="fr-fic fr-dib"> The group with missing titles should now have the titles copied over from the other group. If you do not see the results, try pressing "r" on your keyboard to refresh the view. <img src="/uploads%2Fupload%2Fimage%2F5200%2Fdirect%2F1606968351218-1606968351218.png" alt="Two horizontal bar charts showing Q14v2 and Q15v2 with identical product labels: both now display "New XR Product B", "Product D", "Product B", "Product F", "Product C", "Product A", "Product E", and "other" with their respective percentage values. The right side shows Console code: "protobi.getDimension(\"Q15v2_\"+c).set('title',protobi.getDimension(\"Q14v2_\"+c).get('title'))}}" with "undefined" result." class="fr-fic fr-dib">
Publishing
Date
Status
Published
Draft
Slug
edit
Content
Thumbnail
Categories
Manage
New to Protobi?
Charts
Making Changes
Intermediate topics for editors
Frequently Asked Questions
SERMO Topics
Tutorial Pages
Internal Docs
Data Processing
Videos
Obsolete
GSG Admin
SERMO Admin
GSG Topics
How to...
Basics for viewers
Basics for editors
For project admins
Advanced topics
Assessments
Articles (in-progress)
New and updated articles
Process data in Protobi
superseded
Text open-end questions
Troubleshooting
Tracking studies
Organizing the view
API References
Tools
AI Database
Checking AI...
Convert to MD
Danger zone
Delete