Jump to content


Exporting issues (related and date fields)

export related date

  • Please log in to reply
9 replies to this topic

#1 wgh000

wgh000

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 06 May 2013 - 03:21 PM

As per title, I need to export for excel all the records of the view with the original values because the same data will be reused in a second time.

 

Actually the issue is

• fields related to another table show in the exported XLS/CSV the linked field and not the original "id"

• date fields are also converted as seen in the web view, but I need to export them in db format YYYY-MM-DD

 

Can you help me?



#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 07 May 2013 - 09:07 AM

1. make another controller function that doesn't have the set_relation (s) functions. this way you will see the actual id (or just change to id instead of a name/description)

2. go to application\config\grocery_crud.php there you will find your answer


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 wgh000

wgh000

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 08 May 2013 - 01:48 PM

Thanks davidoster, but ... ok, I know that I can have a different controller with different configurations, but how can I export, from the "wrong view" the data taken from a 2nd controller?

 

Also, I changed the date format in SQL mode, but when I open the export in Excel, it convert it as a date (doing what it wants!)

 

Can you give me more details?



#4 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 08 May 2013 - 09:09 PM

You load->view as before.

You just omit the set_relation functions.

If you don't mean that then you need to give us a screen capture in order to understand.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#5 wgh000

wgh000

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 10 May 2013 - 12:34 PM

I think I could not explain well the issue. Let's try again.

 

I've got a view where I show a Grocery CRUD that need to have the set_relation active because help valorize some of the fields of the form. Let's say

----------------------------
| id | id_store | my_value |
----------------------------

The ID is hidden, ID_STORE is the field with relation setted to the store table. In this way, while adding / editing, is quite easy choosing the right "id" selecting the store from a dropdown menu.

 

When I export this data, I need to export the original ID_STORE and not the name, because I need to "upload" this csv / xls in a different web app. Actually, the system is exporting not the ID_STORE, but the related "view" for the relation (STORE_NAME). I need to export the ID_STORE field, like when you do a "dump" of the mySQL related table.

 

I actually download

------------------------------------------------
| 1 | san francisco store 1 | text valorized 1 |
------------------------------------------------
| 1 | san francisco store 2 | text valorized 2 |
------------------------------------------------
| 1 | chicago store 1       | text valorized 3 |
------------------------------------------------

 

but I would like to download

----------------------------
| 1 | 1 | text valorized 1 |
----------------------------
| 1 | 2 | text valorized 2 |
----------------------------
| 1 | 3 | text valorized 3 |
----------------------------

 

 

I hope I've been more clear now.

Thanks a lot.



#6 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 11 May 2013 - 09:50 AM

If that's the case..., then explain to me how this happens,

http://eletter.gr/te...ndex.php/test/a


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#7 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 12 May 2013 - 05:48 AM

Well, my sincere apologies!!!

I thought that whatever you see on the screen, it prints also!

I will check again the library code and I will propose a solution.

 

P.S. That's why they say, as long you live you learn.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#8 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 13 May 2013 - 09:59 AM

I was investigating today about the export (and print operations).

At first I thought that it reads the table, checks for foreign keys and/or relations and callbacks and traces back the actual value.

But it is actually much simpler than that.

When a grid is displayed all the values are stored in memory.

So, if you just display the grid you want, without any relations, just like this the export function does work as I first suspected it would!


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#9 wgh000

wgh000

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 13 May 2013 - 04:57 PM

Yes, of course. Grocery print what it shows on the screen, but I don't need that! I need to have a simplest way to manage data by the users and a confortable way to manage data offline.

Do you agree with me that it's easier to choose an ID using a "dropdown menu" instead of find the related value in a table and copy the ID?

 

I think Grocery should have a "double" option to choose if export the view or the raw data...

 

I need the raw data, now...



#10 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 13 May 2013 - 05:16 PM

Your very first (initial) question was answered here and here.

What you ask on this should be posted as a new topic where you need to explain again what you need.

 

P.S. 1: Bear in mind that what might seems easier to you might not be easier (or the best way) for the others.

P.S. 2: Grocery CRUD is based on the initial effort of one person and on the contributions of others. Why don't you build this "double" option feature so we can all benefit from it? If you try it, remember to follow the guidelines on how to extend the library.  :)


Edited by davidoster, 13 May 2013 - 05:18 PM.

____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr






Also tagged with one or more of these keywords: export, related, date

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users