-
-
Notifications
You must be signed in to change notification settings - Fork 178
028 How to change exported values and setup custom import options
A short explanation of how to change the values that are being exported and to have a Custom Import option with an import of the data. Component Builder allows you to have import and export function by default in all the List Views of the components. 00:00:35 The component called IP Data is used to take a IP address and translate it to determine from which country it came and then a costing update is performed on your website based on that IP Data.
Select IP Tables which is on the IP Table Dashboard. 00:01:07 The 'CNTRY' value may be seen, that is the country, and the 'REGISTRY', which indicates to who the IP table belongs and the range,'IP from'/'IP to' is being reflected.
If 'Export Data' has been clicked without selecting any values, it will give this warning: 'Please first make a selection from the list'. 00:01:35 Only export values that had been selected. If all needs to be exported, change this value to 'all'. In some instances, if the table is too long, it is not possible to export all the values at once.
Exporting the data in large quantities is not advisable in Joomla. If quantities exceeds 3000 items, rather go to MySQL and get a dump file. 00:02:16 Although it is often seen that the Listview is being used for up to 10000 items, quite complex inheritance in structure is involved. But in this instance having the import and export in mind, makes it quite different. If for example this need to be exported but for some reason this 'ZZZ' or 'AUS' value should instead be replaced by the country name, the following would be a simple implementation of how to perform it. 00:02:51
Click 'Export', save this(Opening Ip_tables). It has been exported, all these AUS values are displayed, and some other values from the database as expected. But if it is suppose to be a different value when it is exported, then take the next step.
Component Builder has this 'getExportdata' method in the model.00:03:26 This 'getExportdata' method has this extra value called '$_export' set to 'true'.00:03:52 A reason why this had been added, is to target this(See video) method with custom scripting. But the difficulty is that this part($group to $query) is custom scripting and it is also been added into the actual 'getlistquery'. 00:04:21 It is the same custom scripting. In the compiler the same custom script is added into the 'getlistquery' as into 'getExportdata. The way to know where it gets executed, is through this value '$_export'. 00:04:49 This value is not set in the 'listquery', it is only set in the Export Data.
The custom scripting is done in the 'Editing the Admin View' area. With the Admin View open, go to PHP and then scroll down until the method ' Add PHP (getListQuery - JModellist)' can be seen and then it should be set to 'Yes'. 00:05:43 The code, that is put there, is added both to the 'getListQuery', as well as to 'exportquery'. If the values need to be changed that had been exported, but not the values that's being shown in the component, it have to be done in the same area. It will be noticed that the same code appears in two distinct places(See video). 00:06:22 If some value needs to be changed, that may be done simply by adding another 'lookup', and add this '$_export=true'. To see where all this '$_export=true' is appearing, go to any List model and search and it may be seen in different places(See video). 00:06:55
Go to the 'getExportdata' area. In the previous tutorial it had been explained how to add some customization to the values in the 'listview', some HTML, Here(See video) should be determined if the 'export' is 'set' or is it 'true'?
NB. Don't add this feature here. 00:07:25
The adding of this customization of coloring is avoided because it should not be running during the export process. Only the values is needed. Again it can be seen that the export values are used. 00:07:53 That is the places where the export function is involved, and by using this '$_export' it is possible to identify whether it's an export or not. If it is, changes can be made to the values as necessary. Going back to the back end just to show that this(PHP area) is the place where the query had been done. In the area 'Add PHP(getitems Method-before the translation fix & decryption)'. 00:08:30 It can be checked whether a export had been done and this can be taken(see video) instead of the exclamation, if the export '(isset($_export)' and export is true(isset($_export)&&$_export), then in the area below may be done what is necessary. That is if the values need to be changed before translation or before decryption or it may be made after. 00:09:18 So after all was done and the values need to be changed on an export, it may be added.<<<<<<<<<<<<<<<<<
Now if you want to have a different import type as usual. Usually to import values you just 00:09:40 update these. If you leave the id in it updates, if you take the id out it creates. Now let's say I don't want to use the ids I want to use these values instead. And then you need to create a custom import concept. We have tried to make that easy as possible and yet it's still quite complex. 00:10:13
You basically go to custom import. There is a little warning, because it is quite daunting. You add there yes, and it will load into these areas, the actual script that are used by default in these various concepts. 00:10:38 If you do not understand what you seeing here, I suppose you should rather not be trying to do this or you should seek some classes from lynda.com or elsewhere. Udome it's also a good place sharpen up some of your PHP skills. Then you could make changes to this, for example take out that chunk, 00:11:09 then do a search, put something in you can find like your name or whatever. Save and compile it. Go and search where does this come up? Where does this come out? What is happening? You'd realize that 00:11:31 we don't completely remove the default import method when you do this kind of changes. There is a way that you could make these changes, and have two import methods next to each other. It's not that easy but it's possible and it all depends on what you are doing in 00:11:59 this HTML and PHP view area. So it depends on what you do in the view. Currently this is set up to do your normal import as you would usually do. Changing this will also change your normal import concept. That is how you would Change your custom import concept. Please read through the code. Maybe compile it. 00:12:33 Go look at what it's done. Look around see how the default import and concepts work. Then make your changes accordingly. I have used this area quite a lot for various applications, because sometimes you have a user that says to you or a client, I want to import these sets of csv files, and they are like 4000 or 40000 lines and it needs to select only specific values. 00:13:06 Well in that case this area is definitely what you looking for. You'll be able to adapt your import concept to accommodate those kind of complexity. Well that is how to change export values and create custom import values for any field view in the back end of your component. So literally changing how that button behaves and how that one behaves is what I have just shown you.
- Home
- Beta Testing
- Custom Code
- PHP Settings
- Demo Component
-
Tutorials
- Hello World JCB
- Intro JCB Guide
- JCB Installation Steps
- Planning Components
- Field Type Overview
- Basic Fields Creation
- Admin View Management
- Advanced Field Usage
- Admin Component Integration
- Component Setting Customization
- Scripting Components
- Component FTP Options
- Dynamic Get Method
- Site View DynamicGet
- Site View Templates
- Template Setup Guide
- Layout Configuration Steps
- Custom Admin Management
- Adding Site Views
- Custom Admin Integration
- MySQL Demo Tweaking
- Global JCB Settings
- Custom Time Field
- User Helper Integration
- Email Helper Usage
- Message Store Email
- List View Unescape
- Export Import Customization
- Overwrite Custom Fields
- List Field Filtering
- Automatic Code Import
- Manual Code Implementation
- Component Export Import
- Custom Admin Buttons
- Translation Management
- Site View Permissions
- Component SQL Updates
- Site Edit Configuration
- JCB Backup System
- Helper Structure Integration
- JCB v2.5 Upgrade
- Tab Setup Guide
- JCB v2.6 Release
- Extended HelloWorld
- Field Rule Validation
- Community Snippets Intro
- Snippet Forking Tutorial
- Pull Request Snippets
- Library Manager Area
- Excel-based Translation
- Dynamic Router Details
- Database Auto Updates
- Subform Quick Demo
- VDM Package Import
- Dynamic File Inclusion
- File Field Upload
- Drag-n-Drop Upload
- Quick HelloWorld JCB
- Non-database Fields
- Dashboard Customization
- Menu Prefix Toggle
- Community JCB Packages
- Collaborative JCB Workflow
- JCB Package Install
- JCB JAB18 Event
- Convenient New Fields
- Component Language Strings
- Library Functionality Anticipation
- Join Field Relations
- License Template Change
- Code Reusability
- Local Dev Environment
- Extended Field Types
- Joomla Custom Fields
- Custom Field Expansion
- Site View Listing
- Run Expansion Method
- Form Site View
- Field URL Update
- Additional Helper Methods
- Field Validation Rules
- New Placeholder Feature
- Component Config Params
- Per-field Default Values