Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load from field

Hi all,

I am using load form field in order to get some stuctured complex data from a field see above code:

TorqueData:

LOAD id,

     serial,

     firmware,

     data_bottom,

     date(testdata) as TestDate;

SQL select  *

from payouttensionlog.log

where testdata>='2013'

order by testdata desc

limit 50;

DataTest:

LOAD

     @1 as Turn,

     @2 as TorqueVal

FROM_FIELD

(TorqueData, data_bottom)

(txt, utf8, no labels, delimiter is ',', msq);

The problem is that i want to associate these load from field data in DataTest wih the id number in Torque Data....

Is there any easy way to achieve this???

Regards

1 Solution

Accepted Solutions
Not applicable
Author

Hi Kabilan,

I just tested your solution and works .

Thanks in advance for you help.

Your solution creates to many synthetic keys though...

I solved my problem in a more efficient way see below:

TorqueData3:

LOAD id,

     serial,

     firmware,

     data_bottom,

     SubField(data_bottom,';') as TorqueVal,

     date(testdata) as TestDate;

SQL select  id,

     serial,

     firmware,

     SUBSTRING(replace(data_bottom,'\n',';'), 1, CHAR_LENGTH(replace(data_bottom,'\n',';')) - 1) as data_bottom,

     testdata

from payouttensionlog.log

where testdata>='2013'

order by testdata desc

limit 50;

I replaced newline with semicolon and trimed the last char. This allowed me to use the native subfield function to achieve the result.

Kind regards,

View solution in original post

7 Replies
agni_gold
Specialist III
Specialist III

Hi,

You can use like this :

load  id,

           serial,

           firmware,

           data_bottom,

           TestDate 

Resident TorqueData;

if this helps please make correct answer .

Thanks

Best Regard

Agnivesh Kumar.

Not applicable
Author

Hi Agnivesh,

I dont get your point???

What i need is to associate Turn,TorqueVal with the id in TorqueData of which they come from.

regards

Not applicable
Author

TorqueData:

LOAD id,

     serial,

     firmware,

     data_bottom,

     date(testdata) as TestDate;

SQL select  *

from payouttensionlog.log

where testdata>='2013'

order by testdata desc

limit 50;

DataTest:

LOAD

     @1 as Turn,

     @2 as TorqueVal

FROM_FIELD

(TorqueData, data_bottom)

(txt, utf8, no labels, delimiter is ',', msq);

Tb1:

Load Turn&TorqueVal as databottom

     ,Turn

     ,TorqueVal

resistent DataTest;

left join

Load distinct data_bottom, id resistent TorqueData;

Regards,

Kabilan K.

Not applicable
Author

Hi Kabilan,

I woudl expect the turn torqueval to look like above

0,32

1,128

2,140

3,150

4,155

5,161

6,165

7,167

8,170

9,170

10,172

11,172

12,174

13,174

14,176

15,178

64,182

For every id. But this is not the case in your solution.

Not applicable
Author

Then use like below

Tb1:

Load Turn&','&TorqueVal as databottom

     ,Turn

     ,TorqueVal

resistent DataTest;

agni_gold
Specialist III
Specialist III

Not applicable
Author

Hi Kabilan,

I just tested your solution and works .

Thanks in advance for you help.

Your solution creates to many synthetic keys though...

I solved my problem in a more efficient way see below:

TorqueData3:

LOAD id,

     serial,

     firmware,

     data_bottom,

     SubField(data_bottom,';') as TorqueVal,

     date(testdata) as TestDate;

SQL select  id,

     serial,

     firmware,

     SUBSTRING(replace(data_bottom,'\n',';'), 1, CHAR_LENGTH(replace(data_bottom,'\n',';')) - 1) as data_bottom,

     testdata

from payouttensionlog.log

where testdata>='2013'

order by testdata desc

limit 50;

I replaced newline with semicolon and trimed the last char. This allowed me to use the native subfield function to achieve the result.

Kind regards,