Skip to main content
1-Visitor
October 4, 2014
Question

Apply Regular Expression on Infotable row

  • October 4, 2014
  • 1 reply
  • 1360 views

Hi,


I am facing some issue working with data in Infotable as below:

1. I have a service that query data from a MYSQL server using SELECT DateTime statement (only return the DateTime column data).

2. The result is returned properly with one of the column representing DateTime with format MM/DD/YYYY HH:mm

3.  Now I want to populate through every single row of data, and use regular expression to retrieve the DD info from every row.


Problem faced:

It seems that the getrow(rowindex) is returning format like this: {DateTime=com.thingworx.types.primitives.StringPrimitive@16b2f63}.

I am not sure how to parse this type of data from Infotable using the regular expression. How do I convert the StringPrimitive type to normal String type in order for me to parse the data in Infotable accordingly?


Please kindly advise. Thanks in advance.




    1 reply

    1-Visitor
    October 8, 2014

    I think you want to do something like this where rawdata is your infotable name

    var rawdata = Things["DatabaseName"].GetDateTimeData


    for each (var row in rawdata.rows) {
     var DateTimeValue = row.DateTime;
     var Day = dateFormat(DateTimeValue, "dd");

    }