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

Store table with different moth name

Hello,

I have a table with info sorted by month. I need to do an store table for each month inside the table (12 different files in one year), I used to so something like this, but with a calendar, not when the table already has the month as a dimension inside it. My script looks like this:

Consolidado:

LOAD * INLINE [

    Fecha, Info

    Ene 2014, 2

    Feb 2014, 3

    Mar 2014, 4

    Abr 2014, 5

    May 2014, 6

    Jun 2014, 7

    Jul 2014, 8

    Ago 2014, 9

    Sep 2014, 10

    Oct 2014, 11

    Nov 2014, 12

    Dic 2014, 13

    Ene 2015, 14

    Feb 2015, 15

    Mar 2015, 16

    Abr 2015, 17

    May 2015, 18

    Jun 2015, 19

    Jul 2015, 20

    Ago 2015, 21

    Sep 2015, 22

    Oct 2015, 23

    Nov 2015, 24

    Dic 2015, 25

    Ene 2016, 26

    Feb 2016, 27

    Mar 2016, 28

    Abr 2016, 29

    May 2016, 30

    Jun 2016, 31

    Jul 2016, 32

    Ago 2016, 33

    Sep 2016, 34

    Oct 2016, 35

    Nov 2016, 36

    Dic 2016, 37

    Ene 2017, 38

    Feb 2017, 39

    Mar 2017, 40

    Abr 2017, 41

    May 2017, 42

    Jun 2017, 43

    Jul 2017, 44

];

let vFecha = Fecha;

store Consolidado into   (txt, delimiter is ',');

Pls help me

1 Solution

Accepted Solutions
sunny_talwar

My bad, forgot to add single quotes around Fecha

FOR i = 1 to FieldValueCount('Fecha')

View solution in original post

6 Replies
sunny_talwar

How many files are you planning to save? one file or one file for each MonthYear?

Not applicable
Author

One per Month

sunny_talwar

May be something like this

Consolidado:

LOAD * INLINE [

    Fecha, Info

    Ene 2014, 2

    Feb 2014, 3

    Mar 2014, 4

    Abr 2014, 5

    May 2014, 6

    Jun 2014, 7

    Jul 2014, 8

    Ago 2014, 9

    Sep 2014, 10

    Oct 2014, 11

    Nov 2014, 12

    Dic 2014, 13

    Ene 2015, 14

    Feb 2015, 15

    Mar 2015, 16

    Abr 2015, 17

    May 2015, 18

    Jun 2015, 19

    Jul 2015, 20

    Ago 2015, 21

    Sep 2015, 22

    Oct 2015, 23

    Nov 2015, 24

    Dic 2015, 25

    Ene 2016, 26

    Feb 2016, 27

    Mar 2016, 28

    Abr 2016, 29

    May 2016, 30

    Jun 2016, 31

    Jul 2016, 32

    Ago 2016, 33

    Sep 2016, 34

    Oct 2016, 35

    Nov 2016, 36

    Dic 2016, 37

    Ene 2017, 38

    Feb 2017, 39

    Mar 2017, 40

    Abr 2017, 41

    May 2017, 42

    Jun 2017, 43

    Jul 2017, 44

];

FOR i = 1 to FieldValueCount(Fecha)

     LET vFecha = FieldValue('Fecha', $(i));

     New_Consolidado:

     NoConcatenate

     LOAD *

     Resident Consolidado

     Where Fecha = '$(vFecha)';

     STORE New_Consolidado into   (txt, delimiter is ',');

     DROP New_Consolidado;

NEXT i

Not applicable
Author

It gives me the following error:

Script line error

FOR i = 1 to FieldValueCount(Fecha)

do you know what could it be?

sunny_talwar

My bad, forgot to add single quotes around Fecha

FOR i = 1 to FieldValueCount('Fecha')

Not applicable
Author

Now it works perfectly, thank you!