Hi
I am working on a flowchart to map data into the excel.
In this process, I need to match the Fund Name with date together, for example, Fund 1 may have March 2018, and June 2018, and Fund 2 may have March 2018 and June 2018 too.
So i create a list = new list(of string()), to make the list like this: {(Fund1, Date1),(Fund2, Date2)}.
My problem is: after i added the fund name and date, which I have tested, do have output value inside.
I have a decision statement that "whether the existing list have the specific “Fund, Date” match, the result never go to True part, which it should have.
It looks right, but I’m no expert. Basically .Contains() looks for an exact match in the list. I’m not sure if this will be an issue though if you are using arrays in a list, because if it is a problem then you’ll need to look at the strings within the array.
You can also use the .Any() to look at the strings.
An example would look like this:
replace lst with your list variable and “abc” and “123” with fundName and dateName respectfully.
Essentially, with that example, it goes through each array in the list and sees if fundName is contained in the array And dateName is in the array. If you need to manipulate the array first for the comparison like to use all caps, then you can use .Select() to change the values in the array first .ToUpper.
I’m wondering if it is because you are comparing array objects with each other rather than the strings, like I mentioned in your first question. But, I’m not sure exactly.
Using String.Join(), you can accomplish this. However, since you have an array of strings in the list, you need a slight manipulation to it: String.Join(System.Environment.Newline,listvariable.Select(Function(x) String.Join(",", x)))
Hopefully that helps. I don’t know for sure if I got that condition right, but it’s something like that.
Clayton, thanks for your so detailed answers and patience!!!
for the first question, I cannot use any because I need the Fund Name match with the date,
for e.g. the list is {(Fund A, March), (Fund A, June), (Fund B, June)}
if I want to know is there any (Fund B, March), the result should be no, But if i use any, it will show yes.
I didn’t quite understand this part, do you mean I am comparing fund name with date?
this part worked!!! it is so good ! thanks ! I got the list I added, and prove that the problem is not in my list.
the root problem still should be the decision statement I wrote.