Skip to main content
simply more productive

The Data Specialist

Thanks to our intuitive transformation designer, you can convert data effortlessly to a variety of formats without knowing how to program. It’s not only efficient, it’s also easy to use.
Up to 100,000 records can be processed with the freeware version!
Flowheater Chart

Net Script LIKE

More
6 years 1 month ago #3486 by JD Cox
Net Script LIKE - Post(3486) was created by JD Cox
I know the problem is 'if (tag.contains(swholesale))', what can I do to make this work
//////////////////////////////////////////////////////////////////////////////////////////
public object DoWork()
{
//string value something like 'DANE, Supply Company, wholesale'
//i'm looking for the tag 'wholesale'

string tag = (string)InValues[0].GetString();
string swholesale = "wholesale";
int icid = 0;

if (tag.contains(swholesale))
{
icid = 205;
}
else
{
icid = 207;
}
return icid;
}

Please Log in or Create an account to join the conversation.

More
6 years 1 month ago - 6 years 1 month ago #3487 by FlowHeater-Team
Replied by FlowHeater-Team on topic Net Script LIKE - Post(3487)
Hi JD,

you need the IndexOf method. Attached you´ll find a short example.

C# script example
Code:
public object DoWork() { string tag = (string)InValues[0].GetString(); string swholesale = "wholesale"; int icid = 0; // StringComparison.OrdinalIgnoreCase = ignore Upper/Lower case if (tag.IndexOf(swholesale, StringComparison.OrdinalIgnoreCase) >= 0) { icid = 205; } else { icid = 207; } return icid; }


File Attachment:

File Name: dotnet-indexof.zip
File Size:2 KB

Best wishes
Robert Stark
Last edit: 6 years 1 month ago by FlowHeater-Team.

Please Log in or Create an account to join the conversation.

More
6 years 1 month ago #3488 by JD Cox
Replied by JD Cox on topic Net Script LIKE - Post(3488)
As always, Robert, thank you.
It works great, and thanks for adding in the ignore case.
They only have three tags for now that I manage with a stack of IfThenElses.
This is much easier to manage and cleaner.
Thanks, JD

Please Log in or Create an account to join the conversation.

Time to create page: 0.263 seconds
FlowHeater Logo

FlowHeater - The Data Specialist

Efficient data integration and transformation with FlowHeater – the perfect solution for a seamless transfer of your data.

Legal information

Support & Contact

Contact

Phone:
0951 / 9933 9792

eMail:
This email address is being protected from spambots. You need JavaScript enabled to view it.


Copyright © 2009-2024 by FlowHeater GmbH. All rights reserved.