Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same headers in columns mean withColumns returns wrong column number #19

Open
SimonbJohnson opened this issue Mar 2, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@SimonbJohnson
Copy link
Contributor

SimonbJohnson commented Mar 2, 2020

withColumns function returns the wrong column number if the headers are the same in multiple columns.

Previously this dataset had a column with header Country (the same as column 1 and column 4) and it gave the wrong result until the header was changed.

rough code to test:

dataset.withColumns(['#country+code'].forEach(function(row,col,rowindex){
 console.log(col)
});

Output gave column number as 1, but was expecting 4.

@davidmegginson davidmegginson self-assigned this Mar 2, 2020
@davidmegginson davidmegginson added this to the Release 0.4 milestone Mar 2, 2020
@davidmegginson
Copy link
Member

@SimonbJohnson - could you share a test dataset that triggers the bug? I'm not able to reproduce, but I might be misunderstanding.

@SimonbJohnson
Copy link
Contributor Author

SimonbJohnson commented Mar 3, 2020

Opps forgot to share it. I've also edited the original issue to make it clearer. Here is is:

https://proxy.hxlstandard.org/data.json?force=on&filter01=cut&cut-skip-untagged01=o&url=https%3A%2F%2Fproxy.hxlstandard.org%2Fdata.json%3Ffilter01%3Dappend-list%26append-list-url01%3Dhttps%253A%252F%252Fdocs.google.com%252Fspreadsheets%252Fd%252F1qkolK1mhHVeG1fGdglsGJUShklfbmt4cVNj5mOG9ufw%252Fedit%2523gid%253D895948617%26filter02%3Dcut%26cut-skip-untagged02%3Don%26filter03%3Dexplode%26explode-header-att03%3DIndicator%26explode-value-att03%3Dvalue%26filter04%3Dclean%26clean-whitespace-tags04%3D%2523indicator%26filter05%3Dreplace%26replace-pattern05%3D%255E%2524%26replace-regex05%3Don%26replace-value05%3DNO%26replace-tags05%3D%2523indicator%252Bvalue%26filter06%3Dselect%26select-query06-01%3D%2523indicator%252Bvalue%253DNo%2BData%26select-reverse06%3Don%26filter07%3Dselect%26select-query07-01%3D%2523org%253DEXAMPLE%26select-reverse07%3Don%26filter08%3Dmerge%26merge-url08%3Dhttps%253A%252F%252Fdocs.google.com%252Fspreadsheets%252Fd%252F1GugpfyzridvfezFcDsl6dNlpZDqI8TQJw-Jx52obny8%252Fedit%2523gid%253D0%26merge-keys08%3D%2523country%26merge-tags08%3D%2523country%252Bcode%26filter09%3Drename%26rename-oldtag09%3D%2523indicator-value%26rename-newtag09%3D%2523indicator%26rename-header09%3DCapacity%2BIndicator%26filter10%3Dadd%26add-tag10%3D%2523contact%252Bdisplay%26add-value10%3D%257B%257B%2B%2523contact%252Bname%2B%257D%257D%2B%2528%257B%257B%2B%2523contact%252Bemail%2B%257D%257D%2529%26add-header10%3DCEA%2BFocal%2BPoint%26filter11%3Dcut%26cut-exclude-tags11%3D%2523contact%252Bname%252C%2523contact%252Bemail%26filter12%3Dreplace%26replace-pattern12%3DYES%26replace-value12%3D1%26replace-tags12%3D%2523indicator%252Bvalue%26filter13%3Dreplace%26replace-pattern13%3DNO%26replace-value13%3D0%26replace-tags13%3D%2523indicator%252Bvalue%26filter14%3Drename%26rename-oldtag14%3D%2523indicator%252Bvalue%26rename-newtag14%3D%2523indicator%252Bvalue%26rename-header14%3DCapacity%26filter15%3Drename%26rename-oldtag15%3D%2523country%252Bcode%26rename-newtag15%3D%2523country%252Bcode%26rename-header15%3DCountry%26filter16%3Dsort%26sort-tags16%3D%2523indicator%26force%3Don%26url%3Dhttps%253A%252F%252Fdocs.google.com%252Fspreadsheets%252Fd%252F1qkolK1mhHVeG1fGdglsGJUShklfbmt4cVNj5mOG9ufw%252Fedit%2523gid%253D2002415244

@davidmegginson
Copy link
Member

Thanks for the share. I tweaked your code example a bit, so that it reads

dataset.withColumns(['#country+code']).forEach(function(row, dataset, rowindex) {
    console.log(row)
});

The row values look right. I'm a little unclear about the expected output, so maybe we should jump to a Skype chat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants