JavaScript マスターズクラス2
中級
これはEngineering分野の自動化ワークフローで、9個のノードを含みます。主にCode, ManualTriggerなどのノードを使用。 JavaScript の配列メソッドを使用してデータレコードを重複排除
前提条件
- •特別な前提条件なし、インポートしてすぐに使用可能
使用ノード (9)
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"id": "hQXDUS1zEZFI37kU",
"meta": {
"instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
},
"name": "Javascript Masterclass2",
"tags": [],
"nodes": [
{
"id": "81dd117a-81f3-4dff-a7c7-664bc161987e",
"name": "'Test workflow'クリック時",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-420,
80
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6f507b8c-8a8d-4c89-acdf-f0f4eda9fa94",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
-660,
-260
],
"parameters": {
"color": 7,
"width": 400,
"height": 580,
"content": "# 🧱 Data Deduplication Tutorial\n\n**Author:** David Olusola\n\n## 🚀 n8n Coaching\nUnlock the full potential of n8n with personalized, one-on-one coaching. Whether you're just getting started or need help solving a specific challenge, I'll guide you step-by-step so you can build confidently and efficiently.\n\n👉 [Book Coaching Session](mailto:david@daexai.com?subject=n8n%20Coaching%20Request)\n\n## 🔧 n8n Consulting\nHave a complex automation project, unique integration needs, or want a custom workflow built from scratch? Let's collaborate to design and implement a robust solution tailored to your business.\n\n📩 [Inquire About Consulting Services](mailto:david@daexai.com?subject=n8n%20Consultation%20Request)"
},
"typeVersion": 1
},
{
"id": "eadab384-f0d6-48b1-b4dd-e0eb106228ac",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
220
],
"parameters": {
"color": 7,
"width": 300,
"height": 360,
"content": "## 📊 Sample Data\n\nThis node creates sample user data with intentional duplicates based on email addresses.\n\n**What it does:**\n- Creates an array of users\n- Includes duplicate entries (same email)\n- Simulates real-world messy data\n\n**Next Step:** Pass this data to the deduplication code node"
},
"typeVersion": 1
},
{
"id": "745ba692-ffa8-4ac6-851f-fb9dde8392f2",
"name": "付箋2",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
220
],
"parameters": {
"color": 7,
"width": 300,
"height": 380,
"content": "## 🧹 Deduplication Logic\n\n**Key Concepts:**\n- `filter()` - Creates new array with filtered elements\n- `findIndex()` - Returns index of first matching element\n- `index === self.findIndex()` - Keeps only first occurrence\n\n**Algorithm:**\n1. Parse JSON data\n2. Filter array keeping first occurrence of each email\n3. Transform back to n8n format\n4. Return deduplicated results"
},
"typeVersion": 1
},
{
"id": "8bc4bd06-b031-4909-8210-5ec1f11366ff",
"name": "付箋3",
"type": "n8n-nodes-base.stickyNote",
"position": [
460,
220
],
"parameters": {
"color": 7,
"width": 300,
"height": 380,
"content": "## 📈 Results\n\n**What you'll see:**\n- Original count: 6 items\n- Deduplicated count: 4 items\n- Duplicates removed: 2 items\n\n**Use Cases:**\n- Clean data before CRM import\n- Prevent duplicate database entries\n- Data quality improvement\n- ETL pipeline cleanup"
},
"typeVersion": 1
},
{
"id": "75a624be-73e9-4b35-ae58-33bc45a0208c",
"name": "サンプルデータ作成",
"type": "n8n-nodes-base.code",
"position": [
-200,
80
],
"parameters": {
"jsCode": "// Create sample data with intentional duplicates\nconst usersWithDuplicates = [\n { id: 1, name: \"John Doe\", email: \"john@example.com\", department: \"Engineering\" },\n { id: 2, name: \"Jane Smith\", email: \"jane@example.com\", department: \"Marketing\" },\n { id: 3, name: \"John Doe\", email: \"john@example.com\", department: \"Engineering\" }, // Duplicate\n { id: 4, name: \"Bob Johnson\", email: \"bob@example.com\", department: \"Sales\" },\n { id: 5, name: \"Alice Brown\", email: \"alice@example.com\", department: \"HR\" },\n { id: 6, name: \"Jane Smith Updated\", email: \"jane@example.com\", department: \"Marketing\" } // Duplicate\n];\n\n// Return the sample data as a single item with usersJson property\nreturn [{\n json: {\n usersJson: JSON.stringify(usersWithDuplicates),\n totalCount: usersWithDuplicates.length,\n message: \"Sample data with duplicates created\"\n }\n}];"
},
"typeVersion": 2
},
{
"id": "909634f2-52ad-4f98-aad0-7c3d8a8b8e43",
"name": "ユーザー重複排除",
"type": "n8n-nodes-base.code",
"position": [
140,
80
],
"parameters": {
"jsCode": "// 🧱 Data Deduplication Code Node\n// Use Case: Clean up duplicates before inserting into DB or CRM\n\n// Parse the users JSON from the previous node\nconst users = JSON.parse(items[0].json.usersJson);\n\n// Deduplicate users based on email address\n// This keeps the first occurrence of each unique email\nconst uniqueUsers = users.filter(\n (user, index, self) => \n index === self.findIndex(u => u.email === user.email)\n);\n\n// Log the deduplication results\nconsole.log(`Original count: ${users.length}`);\nconsole.log(`Deduplicated count: ${uniqueUsers.length}`);\nconsole.log(`Duplicates removed: ${users.length - uniqueUsers.length}`);\n\n// Return the deduplicated users in n8n format\n// Each user becomes a separate item in the workflow\nreturn uniqueUsers.map(user => ({ json: user }));"
},
"typeVersion": 2
},
{
"id": "59855549-51e4-42df-b586-730ff1e59e67",
"name": "結果表示",
"type": "n8n-nodes-base.code",
"position": [
500,
80
],
"parameters": {
"jsCode": "// Display the final results with statistics\nconst currentItems = items;\nconst uniqueCount = currentItems.length;\n\n// Create a summary of the deduplication process\nconst summary = {\n deduplicated_users: currentItems.map(item => item.json),\n statistics: {\n unique_users_count: uniqueCount,\n process_completed: true,\n timestamp: new Date().toISOString()\n },\n message: `Successfully deduplicated data - ${uniqueCount} unique users remaining`\n};\n\nreturn [{ json: summary }];"
},
"typeVersion": 2
},
{
"id": "2a5c40fc-ff56-4e54-b06e-4c56e2c4da0e",
"name": "付箋4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-140,
-240
],
"parameters": {
"color": 7,
"width": 430,
"height": 330,
"content": "## 🎯 Learning Objectives\n\n**After this tutorial you'll understand:**\n\n✅ How to use JavaScript array methods in n8n\n✅ Data deduplication techniques\n✅ Working with JSON data in Code nodes\n✅ Transforming data between n8n items\n✅ Practical use cases for data cleaning\n\n**Best Practices:**\n- Always validate input data\n- Consider performance for large datasets\n- Test with various duplicate scenarios\n- Add error handling for production use"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "03170dda-ff22-468b-be1c-e32424a27c66",
"connections": {
"909634f2-52ad-4f98-aad0-7c3d8a8b8e43": {
"main": [
[
{
"node": "59855549-51e4-42df-b586-730ff1e59e67",
"type": "main",
"index": 0
}
]
]
},
"75a624be-73e9-4b35-ae58-33bc45a0208c": {
"main": [
[
{
"node": "909634f2-52ad-4f98-aad0-7c3d8a8b8e43",
"type": "main",
"index": 0
}
]
]
},
"81dd117a-81f3-4dff-a7c7-664bc161987e": {
"main": [
[
{
"node": "75a624be-73e9-4b35-ae58-33bc45a0208c",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - エンジニアリング
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
インタラクティブなコードチュートリアル
対話のRPGスタイルのチュートリアルゲームでJavaScriptプログラミングを学ぶ
Code
Manual Trigger
Code
Manual Trigger
11 ノードDavid Olusola
エンジニアリング
コードノードを理解する
コードノードでJavaScriptデータ処理を学ぶ:フィルタリング、分析、エクスポートの例
Set
Code
Manual Trigger
+
Set
Code
Manual Trigger
11 ノードDavid Olusola
エンジニアリング
リード獲得自動化ツール:Apify から Google スプシッドへ
データクリーニングを使用してApifyからGoogle Sheetsへのビジネスリードの自動収集
Set
Code
Http Request
+
Set
Code
Http Request
6 ノードDavid Olusola
営業
Google Workspace、PDF、メール自動化で商業保険提出
Googleスイート、PDF、メールを使用したビジネス保険申請プロセスの自動化
If
Set
Code
+
If
Set
Code
37 ノードDavid Olusola
文書抽出
人事日払い管理
JavaScriptを使用してHR従業員の日付追跡とリマインダーを自動化
Set
Code
Gmail
+
Set
Code
Gmail
18 ノードDavid Olusola
人事
AIリードマシンProfessional版:Google Maps→Slack→HubSpot→$$$
Googleマップ、GPT-4、HubSpotを使った自動リード生成とクオリファイアケーション
If
Set
Code
+
If
Set
Code
16 ノードDavid Olusola
営業
ワークフロー情報
難易度
中級
ノード数9
カテゴリー1
ノードタイプ3
作成者
David Olusola
@dae221I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com
外部リンク
n8n.ioで表示 →
このワークフローを共有