You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

tLdapInput能否设置两种分隔符?多值字段拆分null问题求解

Handling Multiple Delimiters in tLdapInput

First off, the straightforward answer: tLdapInput doesn’t support setting multiple distinct delimiters directly in its "Multi-value field separator" property—it only accepts a single character or string. But don’t worry, there are easy workarounds to fix the whitespace-related null values you’re seeing.

Here are three practical solutions tailored to your scenario:

1. Normalize Delimiters Before Processing with tReplace

This is the simplest fix—standardize all your delimiters to be identical before tLdapInput splits them:

  • Add a tReplace component right before your tLdapInput.
  • In the tReplace settings:
    • Set "Search" to the regex ;\s+ (this matches a semicolon followed by one or more spaces).
    • Set "Replace with" to just ;.
  • This will convert all instances of ; into ;, making your delimiters consistent. Now tLdapInput can split correctly using ; as the separator, and you won’t get leading spaces in your values that break OU name extraction and cause nulls.

2. Clean Up Values After Splitting

If preprocessing isn’t feasible, you can fix the whitespace after the split:

  • After tLdapInput splits the values, use a tMap component to process each element in the split array.
  • For each value, apply the trim() method to remove leading/trailing whitespace. For example, if your split field is roles, you can loop through it and use row1.roles[i].trim() in the tMap expression.
  • This ensures every role string starts with ou= instead of a space, so your name extraction logic works as expected.

3. Custom Split with Regex in tJavaRow

For full control, handle the splitting yourself using a regex that matches both delimiter variants:

  • Add a tJavaRow component after retrieving the raw LDAP attribute value.
  • Use the regex ;\\s* to split the string—it matches a semicolon followed by zero or more spaces, so it works for both ; and ; .
  • Example code snippet:
    String rawRoles = row1.rawRoles;
    if (rawRoles != null) {
        String[] cleanedRoles = rawRoles.split(";\\s*");
        output_row.roles = cleanedRoles;
    } else {
        output_row.roles = new String[0];
    }
    
  • This splits the string correctly regardless of spacing, and each role will be free of leading whitespace that caused nulls.

The root cause of your null values is that splitting on ; leaves some elements starting with a space (like ou=ROLE_COM_SOUSCRIPTION...). Your OU name extraction logic likely expects the string to start with ou=, so the leading space breaks that parsing. Any of the above fixes will resolve this issue.

内容的提问来源于stack exchange,提问作者Steve Diarrassouba

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 23:22:47