Getting data from Website and Load to datatable

Hi team,

I have the following scenario for you.
When I process POs in a website some POs may fault or may not be actual POs. As a result of that they get ejected from the PO #s field and pop up in above the field. We have to get those numbers (faulted POs) and send them back to a customer for validatation or correction. I want to know how to load these POs to data table after getting them from where they are displayed. Here is the screenshot for your visibility.

Thanks a lot for your help!

Hi,

How about the following step?

  1. Create empty DataTable for storing failedPOs, in advance.
  2. Submit data
  3. Check if the element which contains failed POs exists using CheckAppState then get value
    Or if the element always exists, use GetText then check it value is empty or not.
  4. If failed POs exist, add it using AddDataRow

The following is mock image.

Regards,

@Yoichi Yes that works. I’ll mark this as a solution. However, the POs you see in the screenshot are trying to come into the datatable as a one long string. How can I split and make it load into each row per in the data table? Please let me know if this is not clear. I will elaborate more.

By the way, I do not need type into.

HI,

Can you tr to use ForEAch with the following expression?

failedPOs.Split({","c}).Select(Function(s) CInt(s.Trim))

Please set Int32 at TypeArgument of ForEach

Regards,

Yes, I set the Int32 but I receive
For Each Arthmetic Operation Resulted in an overflow

Hi,

Can you share content of failedPOs variable?

Regards,

Thanks!

@Yoichi
Is the screenshot helpful?

HI,

It’s larger than Int32.Max (2147483647). Please use Decimal or Double type.

Set column datatype as Decimal, Double or Object
Set Decimal or Double at TypeArgument of ForEach
Use either of the following expression.

failedPOs.Split({","c}).Select(Function(s) Decimal.Parse(s.Trim))

or

failedPOs.Split({","c}).Select(Function(s) Double.Parse(s.Trim))

Regards,

@Yoichi

Thanks, Now I do not see error. However, the number are not separated. They just appear as one-long number but I want them to be comma separated and listed like you see here123456, 456234.
Now I receive as 123456456234

Thanks!

Hi,

It seems GetText returns long number.

image

Can you try to use preview extraction of get text, then try to find method which we can get them separately?

image

image

@Yoichi
Unfortunately, the options look like text related, not numbers


As you can see from the screenshot, the rejected POs should be reported either via comma separated or listed in rows.

Thanks!

HI,

How about using GetAttibute instead of GetText?

System.Text.RegularExpressions.Regex.Matches(failedPOs,"\d{6,}").Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) Decimal.Parse(m.Value))

Please try “innerText” attribute and “innerHTML” attribute.

The above assumes PO is 6 or more digits.

Regards,

@Yoichi
Innerhtml works fine. Innertext did not
Thanks a lot for the help!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.