有没有一种方法可以拆分以下格式的列表:“字符串1”,“字符串2”,“字符串3”,

时间:2019-09-13 11:36:02

标签: c# sql split filtering where-in

我需要对现有的XtraReport执行过滤,并且我只想查看具有其ID的某些特定记录。

当我执行此代码时,它将成功应用。

XtraReportOrder report = new XtraReportOrder();
report.FilterString = "orderId IN ('11092', '11093')";
report.ShowPreviewDialog();

我想用这样的东西,

report.FilterString = "orderId IN ("+MyList.ToConvertSthConvinient+")";

1 个答案:

答案 0 :(得分:6)

您可以结合使用Endpoints.find( { commands: {$elemMatch: {"_id": { $in: ["5d7b4ef6f691b71b5097e9d1"]}}} }, { 'commands.$': 1 } ) ,LINQ和字符串插值功能:

var log4js = require("log4js");

log4js.configure({
  appenders: {
    out: {
      type: 'stdout',
      layout: {
        type: 'pattern',
        pattern: '[%d] [%p] [%c] [%x{context}] - %m%n',
        tokens: {
          context: function(logEvent) {
            let returnVal = logEvent.data[1] ? logEvent.data[1].context : undefined;
            if (returnVal) {
              logEvent.data.pop();
            } else {
              returnVal = 'null'; // set any default value if context is not passed.
            }
            return returnVal;
          }
        }
      }
    }
  },
  categories: {
    default: {
      appenders: ['out'],
      level: 'INFO'
    }
  }
});

log4js.level = 'info';
let logger = log4js.getLogger();

logger.info('Hello', { context: 'context_value'}); // prints [2019-09-13T16:50:48.818] [INFO] [default] [context_value] - Hello
logger.info('Hello'); // prints [2019-09-13T16:50:48.820] [INFO] [default] [null] - Hello