Extract the QuoteNum and LineNum from CopyLines

,

Hi, I am trying to warn users when copying quote lines where the configurator has been updated since the line was entered. I have managed to do this using a BPM for Duplicating a Quote, but when it comes to copying lines the sourceQuote and sourceLine are together in a string sourceQuoteLines;


Can anybody help with the code to extract the sourceQuote number and sourceQuote line into variables for use in my code.
Thanks in advance
Adrian.

string sourceString = sourceQuoteLines ;
  
int num2 = 1;

while (true)
{
          if (num2 <= sourceString.Split('~').Length)
          {
              int quoteNum = Convert.ToInt32(Epicor.Utilities.StringExtensions.Entry(Epicor.Utilities.StringExtensions.Entry(sourceString, num2 - 1, '~'), 1, '`'));
              int quoteLine = Convert.ToInt32(Epicor.Utilities.StringExtensions.Entry(Epicor.Utilities.StringExtensions.Entry(sourceString, num2 - 1, '~'), 0, '`'));
              
               ++num2;
          }
          else
          break;
}
2 Likes

I got this tucked away somewhere in my notes

for (i = 1; i <= (sourceQuoteLines.Split(Ice.Constants.ListSeparator).Length); i++)
{
	sourceQuote = Compatibility.Convert.ToInt32(sourceQuoteLines.Entry(i - 1, Ice.Constants.ListSeparator).Entry(1, '`'));
	sourceLine = Compatibility.Convert.ToInt32(sourceQuoteLines.Entry(i - 1, Ice.Constants.ListSeparator).Entry(0, '`'));
}

But I prefer to use the StringExtensions class that Arul pointed out.

1 Like

Thank you @Arul and @hkeric.wci, that was just what I was looking for.

I will use Arul’s example seeing as you recommend it Haso :slight_smile:

Thanks again guys.