我有一个CustomerTable,在表中列出了CustomerID。我想创建一个名为STATUS的新列,以检查他是否是表中存在前几行的新客户,如果表中已经存在记录,则为新客户TRUE
返回FALSE
。有没有一种方法可以使用dplyr
完成。另外,我不想用CUSTOMER_ID的sort
表
## Input would be just the CUSTOMER_ID's from the below table and the Output STATUS is appended to it.
CUSTOMER_ID STATUS
1: 101 FALSE
2: 102 FALSE
3: 103 FALSE
4: 101 TRUE
5: 104 FALSE
6: 105 FALSE
7: 106 FALSE
8: 103 TRUE
9: 104 TRUE
答案 0 :(得分:0)
因为我无法删除问题,所以只是从评论中拿出小费并发布了答案。
private void SaveButton_Click(object sender, EventArgs e)
{
Button b = (Button)sender;
DateTime d = (DateTime)b.Tag;
List<TextBox> t = new List<TextBox>(AutoControls.OfType < TextBox());
//Autocontrols it's the list with ALL the dynamically generates controls in that form.
var g = t.Where(x => x.Tag == b.Tag); // expecting 4 textboxes, but returns 0
var g = t.Where(x => x.Tag == b.Tag).ToList(); // 0
var g = t.FindAll(x => x.Tag == b.Tag); //returns 0