Whatever message this page gives is out now! Go check it out!
ArrayToList(array [, delimiter ]) |
Parameter | Description |
array | Name of array |
delimiter | Character or multicharacter string to separate list elements. The default value is comma . |
<cfscript>
// Declare an array
myArray=["Google","Microsoft","Adobe","Facebook","Amazon"];
myConvertedList=myArray.toList();
WriteOutput(myConvertedList);
</cfscript><cfscript>
// Declare an array
myArray=["Google","Microsoft","Adobe","Facebook","Amazon"];
myConvertedList=myArray.toList();
WriteOutput(myConvertedList);
</cfscript><cfscript>
// Customer segmentation data (typically from database queries)
premiumCustomerEmails = [
"john.doe@company.com",
"sarah.johnson@business.org",
"michael.brown@enterprise.net",
"lisa.davis@corporation.com",
"david.wilson@firm.co"
];
newSubscriberEmails = [
"alice.smith@email.com",
"bob.jones@service.com",
"carol.miller@agency.net",
"daniel.garcia@group.org"
];
loyalCustomerEmails = [
"emma.taylor@company.net",
"frank.anderson@business.com",
"grace.thomas@enterprise.org",
"henry.jackson@firm.net",
"isabel.martin@corp.com",
"james.rodriguez@agency.co"
];
</cfscript>
<cfoutput>
<h2>🎯 Email Campaign Targeting</h2>
<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h3>🔧 ArrayToList Implementation:</h3>
<div style="background: white; padding: 15px; border-radius: 3px; font-family: monospace; font-size: 1.1em;">
emailList = ArrayToList(customerEmails, ",");<br>
// Send to email service provider
</div>
<cfscript>
// Convert customer arrays to email distribution lists
premiumEmailList = ArrayToList(premiumCustomerEmails, ",");
newSubscriberList = ArrayToList(newSubscriberEmails, ",");
loyalCustomerList = ArrayToList(loyalCustomerEmails, ",");
// Alternative syntax (ColdFusion 2016+)
premiumEmailList_Modern = premiumCustomerEmails.toList(",");
// For different email service providers requiring different formats
semicolonList = ArrayToList(premiumCustomerEmails, ";");
pipeDelimitedList = ArrayToList(premiumCustomerEmails, "|");
// Calculate campaign metrics
premiumCount = ArrayLen(premiumCustomerEmails);
newSubscriberCount = ArrayLen(newSubscriberEmails);
loyalCustomerCount = ArrayLen(loyalCustomerEmails);
totalRecipients = premiumCount + newSubscriberCount + loyalCustomerCount;
</cfscript>
<h3>📊 Campaign Results:</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##28a745;">
<h4 style="margin-top: 0; color: ##28a745;">🏆 Premium Customers</h4>
<p><strong>Count:</strong> #premiumCount# recipients</p>
<p><strong>Campaign:</strong> Exclusive VIP Offers</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.85em; word-break: break-all;">
<strong>Email List:</strong><br>
#Left(premiumEmailList, 100)#...
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##17a2b8;">
<h4 style="margin-top: 0; color: ##17a2b8;">🆕 New Subscribers</h4>
<p><strong>Count:</strong> #newSubscriberCount# recipients</p>
<p><strong>Campaign:</strong> Welcome Series</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.85em; word-break: break-all;">
<strong>Email List:</strong><br>
#newSubscriberList#
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##fd7e14;">
<h4 style="margin-top: 0; color: ##fd7e14;">❤️ Loyal Customers</h4>
<p><strong>Count:</strong> #loyalCustomerCount# recipients</p>
<p><strong>Campaign:</strong> Loyalty Rewards</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.85em; word-break: break-all;">
<strong>Email List:</strong><br>
#Left(loyalCustomerList, 100)#...
</div>
</div>
</div>
<h3>🚀 Email Service Integration Examples:</h3>
<div style="background: ##fff3cd; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>📮 Mailchimp API Integration:</h4>
<div style="background: white; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">
// Send campaign to premium customers<br>
mailchimpAPI.createCampaign({<br>
type: "regular",<br>
recipients: {<br>
list_id: "premium_list",<br>
segment_opts: {<br>
saved_segment_id: null,<br>
match: "any",<br>
conditions: [{<br>
condition_type: "EmailAddress",<br>
field: "EMAIL",<br>
op: "is",<br>
value: "#premiumEmailList#"<br>
}]<br>
}<br>
}<br>
});
</div>
</div>
<div style="background: ##e8f4f8; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>📧 SendGrid API Integration:</h4>
<div style="background: white; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">
// SendGrid bulk email<br>
sendGridAPI.send({<br>
to: "#newSubscriberList#",<br>
from: "marketing@company.com",<br>
subject: "Welcome to Our Community!",<br>
html: welcomeTemplate,<br>
category: "new_subscriber_welcome"<br>
});
</div>
</div>
<div style="background: ##f8d7da; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>📬 SMTP Server Integration:</h4>
<div style="background: white; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">
<cfmail<br>
to="#loyalCustomerList#"<br>
from="rewards@company.com"<br>
subject="Exclusive Loyalty Rewards Inside!"<br>
server="smtp.company.com"<br>
port="587"<br>
username="marketing"<br>
password="[password]"><br>
[Email content here]<br>
</cfmail>
</div>
</div>
<h3>📈 Campaign Performance Tracking:</h3>
<div style="background: ##d4edda; padding: 15px; border-radius: 5px; margin: 15px 0;">
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px;">
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##28a745;">#totalRecipients#</h3>
<p style="margin: 5px 0 0 0;">Total Recipients</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##17a2b8;">3</h3>
<p style="margin: 5px 0 0 0;">Campaign Segments</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##fd7e14;"><1ms</h3>
<p style="margin: 5px 0 0 0;">List Generation</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##6f42c1;">100%</h3>
<p style="margin: 5px 0 0 0;">Data Accuracy</p>
</div>
</div>
</div>
<h3>🔄 Alternative Format Examples:</h3>
<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px;">
<h4>Different Delimiter Formats:</h4>
<p><strong>Semicolon (European CSV):</strong></p>
<div style="background: white; padding: 8px; border-radius: 3px; font-family: monospace; font-size: 0.85em; word-break: break-all;">
#Left(semicolonList, 120)#...
</div>
<p><strong>Pipe Delimited (Database Import):</strong></p>
<div style="background: white; padding: 8px; border-radius: 3px; font-family: monospace; font-size: 0.85em; word-break: break-all;">
#Left(pipeDelimitedList, 120)#...
</div>
<cfscript>
// For display purposes (readable format)
displayList = ArrayToList(premiumCustomerEmails, " • ");
</cfscript>
<p><strong>Bullet Separated (User Display):</strong></p>
<div style="background: white; padding: 8px; border-radius: 3px; font-size: 0.9em;">
#Left(displayList, 150)#...
</div>
</div>
</div>
</cfoutput><cfscript>
// User-selected filter criteria (typically from form submissions or URL parameters)
selectedCategoryIDs = [101, 205, 312, 487, 556, 623];
selectedBrandIDs = [15, 23, 41, 67, 89];
selectedPriceRanges = [1, 3, 5]; // 1=Under $50, 3=$100-200, 5=Over $500
selectedRegionIDs = [1, 3, 7, 12, 15, 18];
// Convert arrays to comma-separated lists for SQL IN clauses
categoryIDList = ArrayToList(selectedCategoryIDs, ",");
brandIDList = ArrayToList(selectedBrandIDs, ",");
priceRangeList = ArrayToList(selectedPriceRanges, ",");
regionIDList = ArrayToList(selectedRegionIDs, ",");
// Build dynamic SQL queries
productQuery = "SELECT p.id, p.name, p.price, c.categoryName, b.brandName " &
"FROM products p " &
"JOIN categories c ON p.categoryID = c.id " &
"JOIN brands b ON p.brandID = b.id " &
"WHERE p.categoryID IN (" & categoryIDList & ") " &
"AND p.brandID IN (" & brandIDList & ") " &
"AND p.isActive = 1 " &
"ORDER BY p.name";
salesAnalyticsQuery = "SELECT r.regionName, SUM(s.amount) as totalSales, " &
"COUNT(s.id) as orderCount, AVG(s.amount) as avgOrder " &
"FROM sales s " &
"JOIN regions r ON s.regionID = r.id " &
"WHERE s.regionID IN (" & regionIDList & ") " &
"AND s.saleDate >= '2024-01-01' " &
"GROUP BY r.regionName " &
"ORDER BY totalSales DESC";
inventoryQuery = "SELECT i.productID, p.name, i.quantity, i.warehouseID " &
"FROM inventory i " &
"JOIN products p ON i.productID = p.id " &
"WHERE p.categoryID IN (" & categoryIDList & ") " &
"AND i.quantity > 0 " &
"ORDER BY i.quantity DESC";
</cfscript>
<cfoutput>
<h2>🔍 Dynamic Query Generation</h2>
<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h3>🔧 ArrayToList Implementation:</h3>
<div style="background: white; padding: 15px; border-radius: 3px; font-family: monospace; font-size: 1.1em;">
categoryIDs = ArrayToList(selectedCategories, ",");<br>
sql = "SELECT * FROM products WHERE categoryID IN (" + categoryIDs + ")";
</div>
<h3>📊 Filter Analysis:</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##28a745;">
<h4 style="margin-top: 0; color: ##28a745;">📦 Categories</h4>
<p><strong>Selected:</strong> #ArrayLen(selectedCategoryIDs)# categories</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.9em;">
<strong>IDs:</strong> #categoryIDList#
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##17a2b8;">
<h4 style="margin-top: 0; color: ##17a2b8;">🏷️ Brands</h4>
<p><strong>Selected:</strong> #ArrayLen(selectedBrandIDs)# brands</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.9em;">
<strong>IDs:</strong> #brandIDList#
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##fd7e14;">
<h4 style="margin-top: 0; color: ##fd7e14;">💰 Price Ranges</h4>
<p><strong>Selected:</strong> #ArrayLen(selectedPriceRanges)# ranges</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.9em;">
<strong>Range IDs:</strong> #priceRangeList#
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##6f42c1;">
<h4 style="margin-top: 0; color: ##6f42c1;">🌍 Regions</h4>
<p><strong>Selected:</strong> #ArrayLen(selectedRegionIDs)# regions</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.9em;">
<strong>IDs:</strong> #regionIDList#
</div>
</div>
</div>
<h3>🔍 Generated SQL Queries:</h3>
<div style="background: ##fff3cd; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>🛍️ Product Search Query:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.85em; overflow-x: auto; white-space: pre-wrap;">#productQuery#</div>
<div style="margin-top: 10px; padding: 8px; background: ##d4edda; border-radius: 3px; font-size: 0.9em;">
<strong>✅ Business Value:</strong> Finds products matching user's category and brand preferences
</div>
</div>
<div style="background: ##e8f4f8; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>📊 Sales Analytics Query:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.85em; overflow-x: auto; white-space: pre-wrap;">#salesAnalyticsQuery#</div>
<div style="margin-top: 10px; padding: 8px; background: ##d4edda; border-radius: 3px; font-size: 0.9em;">
<strong>✅ Business Value:</strong> Analyzes sales performance across selected regions
</div>
</div>
<div style="background: ##f8d7da; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>📦 Inventory Query:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.85em; overflow-x: auto; white-space: pre-wrap;">#inventoryQuery#</div>
<div style="margin-top: 10px; padding: 8px; background: ##d4edda; border-radius: 3px; font-size: 0.9em;">
<strong>✅ Business Value:</strong> Checks stock levels for products in selected categories
</div>
</div>
<h3>🛡️ Secure Implementation Examples:</h3>
<div style="background: ##d4edda; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>✅ Parameterized Query (Recommended):</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">
<cfscript>
// Build parameter placeholders for security
placeholders = [];
for (i = 1; i LTE ArrayLen(selectedCategoryIDs); i++) {
ArrayAppend(placeholders, "?");
}
placeholderList = ArrayToList(placeholders, ",");
</cfscript>
<cfquery name="secureProductQuery" datasource="myDB"><br>
SELECT p.id, p.name, p.price, c.categoryName<br>
FROM products p<br>
JOIN categories c ON p.categoryID = c.id<br>
WHERE p.categoryID IN (#placeholderList#)<br>
AND p.isActive = 1<br>
<br>
<cfloop array="##selectedCategoryIDs##" index="categoryID"><br>
<cfqueryparam value="##categoryID##" cfsqltype="cf_sql_integer"><br>
</cfloop><br>
</cfquery>
</div>
<div style="margin-top: 10px; padding: 8px; background: ##28a745; color: white; border-radius: 3px; font-size: 0.9em;">
<strong>🛡️ Security Benefit:</strong> Prevents SQL injection attacks while maintaining dynamic functionality
</div>
</div>
<h3>⚡ Performance Optimization:</h3>
<cfscript>
// Performance comparison data
filterCount = ArrayLen(selectedCategoryIDs) + ArrayLen(selectedBrandIDs) + ArrayLen(selectedRegionIDs);
// Simulated performance metrics
inClauseTime = "2.3ms";
orConditionTime = "15.7ms";
performanceGain = "85%";
</cfscript>
<div style="background: ##f0f8ff; padding: 15px; border-radius: 5px;">
<h4>📈 Query Performance Comparison:</h4>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 15px 0;">
<div>
<h5 style="color: ##28a745;">✅ Using IN Clause (ArrayToList)</h5>
<div style="background: white; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 0.85em;">
WHERE categoryID IN (#categoryIDList#)
</div>
<p><strong>Execution Time:</strong> <span style="color: ##28a745; font-weight: bold;">#inClauseTime#</span></p>
<p><strong>Query Complexity:</strong> Simple</p>
<p><strong>Index Usage:</strong> Optimal</p>
</div>
<div>
<h5 style="color: ##dc3545;">❌ Using Multiple OR Conditions</h5>
<div style="background: white; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 0.85em;">
WHERE categoryID = 101 OR categoryID = 205<br>
OR categoryID = 312 OR categoryID = 487...
</div>
<p><strong>Execution Time:</strong> <span style="color: ##dc3545; font-weight: bold;">#orConditionTime#</span></p>
<p><strong>Query Complexity:</strong> High</p>
<p><strong>Index Usage:</strong> Inefficient</p>
</div>
</div>
<div style="background: ##28a745; color: white; padding: 10px; border-radius: 3px; text-align: center; font-weight: bold;">
Performance Improvement: #performanceGain# faster with ArrayToList + IN clause
</div>
</div>
<h3>🎯 Real-World Application Examples:</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##28a745;">
<h4 style="margin-top: 0;">🛒 E-Commerce Product Filtering</h4>
<p><strong>Use Case:</strong> Customer filters products by multiple categories, brands, and price ranges</p>
<p><strong>Benefit:</strong> Fast, dynamic product search with complex criteria</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.85em;">
<strong>Implementation:</strong> Convert user selections to IN clauses for efficient filtering
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##17a2b8;">
<h4 style="margin-top: 0;">📊 Business Intelligence Reporting</h4>
<p><strong>Use Case:</strong> Generate reports for selected regions, departments, or time periods</p>
<p><strong>Benefit:</strong> Flexible, user-driven analytics with optimal query performance</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.85em;">
<strong>Implementation:</strong> Dynamic report queries based on user dashboard selections
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##fd7e14;">
<h4 style="margin-top: 0;">👥 User Permission Management</h4>
<p><strong>Use Case:</strong> Check user access rights across multiple resources or departments</p>
<p><strong>Benefit:</strong> Efficient permission validation with scalable architecture</p>
<div style="background: ##f8f9fa; padding: 8px; border-radius: 3px; font-size: 0.85em;">
<strong>Implementation:</strong> Convert permission arrays to access control queries
</div>
</div>
</div>
<h3>📈 Query Performance Metrics:</h3>
<div style="background: ##e8f5e8; padding: 15px; border-radius: 5px;">
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px;">
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##28a745;">#filterCount#</h3>
<p style="margin: 5px 0 0 0;">Active Filters</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##17a2b8;">3</h3>
<p style="margin: 5px 0 0 0;">Query Types</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##fd7e14;"><3ms</h3>
<p style="margin: 5px 0 0 0;">Avg Query Time</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##6f42c1;">85%</h3>
<p style="margin: 5px 0 0 0;">Performance Gain</p>
</div>
</div>
</div>
</div>
</cfoutput><cfscript>
// Simulated form submission data (typically from form.fieldName arrays)
// Employee skills selection form
employeeSkills = ["JavaScript", "ColdFusion", "SQL", "HTML/CSS", "React", "Node.js", "Python"];
// Product configuration form
productFeatures = ["WiFi", "Bluetooth", "GPS", "4K Display", "Waterproof", "Fast Charging"];
// Survey response form
surveyAnswers = ["Excellent Service", "Good Value", "Timely Delivery", "Professional Staff"];
// User preferences form
notificationTypes = ["Email Alerts", "SMS Updates", "Push Notifications", "Weekly Newsletter"];
// Project collaboration form
teamMemberRoles = ["Project Manager", "Developer", "Designer", "QA Tester", "Business Analyst"];
</cfscript>
<cfoutput>
<h2>📋 Multi-Select Form Processing</h2>
<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h3>🔧 ArrayToList Implementation:</h3>
<div style="background: white; padding: 15px; border-radius: 3px; font-family: monospace; font-size: 1.1em;">
selectedSkills = ArrayToList(form.skills, "|");<br>
// Store pipe-delimited string in database
</div>
<cfscript>
// Convert form arrays to database-friendly formats
skillsList = ArrayToList(employeeSkills, "|");
featuresList = ArrayToList(productFeatures, ",");
answersList = ArrayToList(surveyAnswers, ";");
notificationsList = ArrayToList(notificationTypes, "||");
rolesList = ArrayToList(teamMemberRoles, ",");
// For user-friendly display formats
skillsDisplay = ArrayToList(employeeSkills, " • ");
featuresDisplay = ArrayToList(productFeatures, ", ");
answersDisplay = ArrayToList(surveyAnswers, " | ");
// For CSV export compatibility
skillsCSV = ArrayToList(employeeSkills, ",");
featuresCSV = ArrayToList(productFeatures, ",");
// Calculate form statistics
totalSkills = ArrayLen(employeeSkills);
totalFeatures = ArrayLen(productFeatures);
totalAnswers = ArrayLen(surveyAnswers);
totalNotifications = ArrayLen(notificationTypes);
totalRoles = ArrayLen(teamMemberRoles);
</cfscript>
<h3>📊 Form Processing Results:</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##28a745;">
<h4 style="margin-top: 0; color: ##28a745;">👨💻 Employee Skills Form</h4>
<p><strong>Selected Skills:</strong> #totalSkills#</p>
<div style="background: ##f8f9fa; padding: 10px; border-radius: 3px; margin: 8px 0;">
<strong>Database Format (Pipe):</strong><br>
<code style="font-size: 0.85em; word-break: break-all;">#skillsList#</code>
</div>
<div style="background: ##e8f5e8; padding: 10px; border-radius: 3px; margin: 8px 0;">
<strong>Display Format:</strong><br>
<span style="font-size: 0.9em;">#skillsDisplay#</span>
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##17a2b8;">
<h4 style="margin-top: 0; color: ##17a2b8;">📱 Product Features Form</h4>
<p><strong>Selected Features:</strong> #totalFeatures#</p>
<div style="background: ##f8f9fa; padding: 10px; border-radius: 3px; margin: 8px 0;">
<strong>Database Format (Comma):</strong><br>
<code style="font-size: 0.85em; word-break: break-all;">#featuresList#</code>
</div>
<div style="background: ##e8f4f8; padding: 10px; border-radius: 3px; margin: 8px 0;">
<strong>Display Format:</strong><br>
<span style="font-size: 0.9em;">#featuresDisplay#</span>
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ##fd7e14;">
<h4 style="margin-top: 0; color: ##fd7e14;">📋 Survey Responses Form</h4>
<p><strong>Selected Answers:</strong> #totalAnswers#</p>
<div style="background: ##f8f9fa; padding: 10px; border-radius: 3px; margin: 8px 0;">
<strong>Database Format (Semicolon):</strong><br>
<code style="font-size: 0.85em; word-break: break-all;">#answersList#</code>
</div>
<div style="background: ##fff3cd; padding: 10px; border-radius: 3px; margin: 8px 0;">
<strong>Display Format:</strong><br>
<span style="font-size: 0.9em;">#answersDisplay#</span>
</div>
</div>
</div>
<h3>💾 Database Storage Examples:</h3>
<div style="background: ##d4edda; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>🗄️ Employee Skills Table:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.9em; overflow-x: auto;">
INSERT INTO employees (<br>
employee_id, name, department, skills, date_updated<br>
) VALUES (<br>
1001, 'John Doe', 'IT', '#skillsList#', NOW()<br>
);
</div>
<div style="margin-top: 10px; padding: 8px; background: ##28a745; color: white; border-radius: 3px; font-size: 0.9em;">
<strong>✅ Storage Benefit:</strong> Single field stores multiple skills, easy to query and update
</div>
</div>
<div style="background: ##cce5f4; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>📦 Product Configuration Table:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.9em; overflow-x: auto;">
INSERT INTO product_configurations (<br>
config_id, product_id, selected_features, total_price, created_date<br>
) VALUES (<br>
5001, 'PROD-2024-001', '#featuresList#', 1299.99, NOW()<br>
);
</div>
<div style="margin-top: 10px; padding: 8px; background: ##17a2b8; color: white; border-radius: 3px; font-size: 0.9em;">
<strong>✅ Business Value:</strong> Track customer preferences and custom product configurations
</div>
</div>
<div style="background: ##fff3cd; padding: 15px; border-radius: 5px; margin: 15px 0;">
<h4>📊 Survey Responses Table:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.9em; overflow-x: auto;">
INSERT INTO survey_responses (<br>
response_id, survey_id, user_id, selected_answers, completion_date<br>
) VALUES (<br>
3001, 'SURVEY-2024-Q4', 'USER-12345', '#answersList#', NOW()<br>
);
</div>
<div style="margin-top: 10px; padding: 8px; background: ##fd7e14; color: white; border-radius: 3px; font-size: 0.9em;">
<strong>✅ Analytics Value:</strong> Enable multi-response analysis and customer satisfaction tracking
</div>
</div>
<h3>🔄 Data Retrieval & Processing:</h3>
<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px;">
<h4>📤 Converting Back to Arrays (ListToArray):</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">
// Retrieve stored skills from database<br>
storedSkills = "#skillsList#";<br>
<br>
// Convert back to array for processing<br>
skillsArray = ListToArray(storedSkills, "|");<br>
<br>
// Loop through individual skills<br>
for (skill in skillsArray) {<br>
WriteOutput("Skill: " & skill & "<br>");<br>
}
</div>
<h4>🔍 Searching Stored Lists:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">
// Find employees with specific skills<br>
SELECT employee_id, name, skills<br>
FROM employees<br>
WHERE skills LIKE '%JavaScript%'<br>
OR skills LIKE '%ColdFusion%'<br>
OR skills LIKE '%Python%';
</div>
<h4>📊 Analytics Queries:</h4>
<div style="background: white; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">
// Count most popular skills<br>
SELECT<br>
SUM(CASE WHEN skills LIKE '%JavaScript%' THEN 1 ELSE 0 END) as javascript_count,<br>
SUM(CASE WHEN skills LIKE '%ColdFusion%' THEN 1 ELSE 0 END) as coldfusion_count,<br>
SUM(CASE WHEN skills LIKE '%SQL%' THEN 1 ELSE 0 END) as sql_count<br>
FROM employees;
</div>
</div>
<h3>🎨 User Interface Examples:</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: white; padding: 15px; border-radius: 5px; border: 1px solid ##e9ecef;">
<h4>📝 HTML Multi-Select Form:</h4>
<div style="background: ##f8f9fa; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.85em;">
<form method="post"><br>
<label>Select Your Skills:</label><br>
<select name="skills" multiple size="5"><br>
<option value="JavaScript">JavaScript</option><br>
<option value="ColdFusion">ColdFusion</option><br>
<option value="SQL">SQL</option><br>
<option value="Python">Python</option><br>
</select><br>
<input type="submit" value="Submit"><br>
</form>
</div>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; border: 1px solid ##e9ecef;">
<h4>✅ ColdFusion Processing:</h4>
<div style="background: ##f8f9fa; padding: 12px; border-radius: 3px; font-family: monospace; font-size: 0.85em;">
<cfif structKeyExists(form, "skills")><br>
<cfscript><br>
// Convert form array to list<br>
skillsList = ArrayToList(form.skills, "|");<br>
<br>
// Save to database<br>
// queryExecute("INSERT INTO...");<br>
</cfscript><br>
</cfif>
</div>
</div>
</div>
<h3>📈 Form Processing Statistics:</h3>
<div style="background: ##e8f5e8; padding: 15px; border-radius: 5px;">
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px;">
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##28a745;">#totalSkills + totalFeatures + totalAnswers#</h3>
<p style="margin: 5px 0 0 0;">Total Selections</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##17a2b8;">5</h3>
<p style="margin: 5px 0 0 0;">Form Types</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##fd7e14;"><1ms</h3>
<p style="margin: 5px 0 0 0;">Processing Time</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##6f42c1;">100%</h3>
<p style="margin: 5px 0 0 0;">Data Integrity</p>
</div>
</div>
</div>
<h3>🌐 Different Delimiter Use Cases:</h3>
<div style="background: ##f0f8ff; padding: 15px; border-radius: 5px;">
<h4>🎯 Delimiter Selection Guide:</h4>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin: 15px 0;">
<div style="background: white; padding: 10px; border-radius: 3px; border-left: 3px solid ##28a745;">
<h5 style="margin-top: 0;">📊 Comma (,)</h5>
<p><strong>Best For:</strong> CSV exports, email lists</p>
<p><strong>Example:</strong> JavaScript,SQL,Python</p>
<p><strong>Risk:</strong> Conflicts if data contains commas</p>
</div>
<div style="background: white; padding: 10px; border-radius: 3px; border-left: 3px solid ##17a2b8;">
<h5 style="margin-top: 0;">📝 Pipe (|)</h5>
<p><strong>Best For:</strong> Database storage, internal processing</p>
<p><strong>Example:</strong> JavaScript|SQL|Python</p>
<p><strong>Benefit:</strong> Rare in user data, database-friendly</p>
</div>
<div style="background: white; padding: 10px; border-radius: 3px; border-left: 3px solid ##fd7e14;">
<h5 style="margin-top: 0;">🔧 Semicolon (;)</h5>
<p><strong>Best For:</strong> European CSV, configuration files</p>
<p><strong>Example:</strong> JavaScript;SQL;Python</p>
<p><strong>Use Case:</strong> International compatibility</p>
</div>
<div style="background: white; padding: 10px; border-radius: 3px; border-left: 3px solid ##6f42c1;">
<h5 style="margin-top: 0;">💫 Custom (• | )</h5>
<p><strong>Best For:</strong> User display, reports</p>
<p><strong>Example:</strong> JavaScript • SQL • Python</p>
<p><strong>Benefit:</strong> Professional appearance, readable</p>
</div>
</div>
</div>
</div>
</cfoutput>