-
-
Notifications
You must be signed in to change notification settings - Fork 178
028 How to change exported values and setup custom import options
I would like to show you How to change the values that are being exported And how to then Have custom import option With an import of the data At the moment Component builder actually allows you To have Import and export by Default in all the list views Of the components to build So that's look at what I mean You're a have a component called IP data Basically used to take care IP address and Translate it to what country it was from and then To update the pricing on your website based on that IP data So Obviously You might want to export or import stuff Into this component So I'm gonna have a look at for example let's say Take the iptables Siri iptables And as you can see We are able to see the The sea ntry value And that place is a country and the The register Who does IP table belongs to And The Range That is being reflected And all this values are here hey if you click export without selecting any Values give you this warning So Obviously you can only export the values that are selected so if you want to export them all you need Change this value to all And then some cases if the table is too big That means you might not be able to export them all at once Any anyway exporting the day that such big quantities is not really ideal I would say anything Beyond 3000 items Rather go to MySQL Get a dump file it's not ideal to use that kind of quantity with Inter Milan away Although we have often seen the listview being used for up to 10000 registered nursery items and quite complex Inheritance in structure I'm talking about the import export now and that's quite the Ok so for our purpose Let's say we wanna exporters but let's say for some reason Instead of us Wanting to see if this zzz or a R Us Value We want to instead see the country name Ok so that would be a simple implementation of what I'm trying to Export now Let's do that And then let's just say this Ok so we've exported it And instead it put the 0s values here And some other values from the database all nicely exported And that's what you would expect But if you wanted this to be a different value when you export it Then you can do the following Component builder works Is it Got this Get export data Method in the model And This Get export data method has this extra value set to True called X Sport underscore Expo A reason why we added this is because it is actually Using the same structure Upgrading the data As you would When Wait let me rephrase this You're able to Target This method with custom scripting But the difficulty is that I see this part that's custom scripting And it's also been added Into the actual Get list query right there you see It's the same custom scripting So basically In Arkham finder we are adding the same custom script into the git list query As we are adding Into the get export data It's the same custom scripting How the way that you would No where is it executing is based on this value This value is not set In the list query of course It is only said In the export data So let's see where this custom scripting is done Sorry if you got your Admin view open you go to PHP and then you scroll down Until you see the method Right Until you see the method it says get list query J model list That's the the The why don't you say yes The the code you put in here Is added both to the Get list query As well Us to the export query so if you want to change the van Who's that are being exported But not the values that's being shown in your component you be doing it in the same area So going back here you'd see that it's that's the same code every here that is Also add it over here see that's the same code Save you were for example In here you wanted to change some value you could do that I simply Adding another lookup or something and you add this X What is true How to see where all this export = true is appearing You go to Any Model which is obviously a list model And we would search and see there it is And there it is again So where are we now we are now in the git export data And we are in the area where it's looking member we showed you in the previous tutorial how How to add some customisation Do your values in the listview Some HTML well here we are asking is the export set or is it true Then Don't do this Yo Don't don't have to speak to you So we are avoiding out in this Customisation on calorie because we don't wanted to run when we are exporting exporting we only wanted The Valleys so then again you can see where using the export values And Get there So those are there The places where the export Function is coming in To play and how we can By using this Underscore export We are able to identify whether it's an export or not if it is we can make the changes to the values Ok Then going back to our back end Just to show you This is the place where we did the query And this is the place Before the translation fix the scripture again We are checking whether we are doing an export And so you could literally take that And say Instead of the exclamation that if it's export is set Come on and exporters And export is true Then Do you think in that area there so that is if you want to change the values For translation or before decryption or if you want to you can do it after After that So after all was done You wanna change the values On export Then you can add it there And that is really as simple as it is Adding Change to your exported values Now If you want to then Have a different import Type as usual Usually to import values you just Update these right and if you leave the ID in at updates if you take the ID out It creates So without an ID it will create With an ID it will update Now let's say you say we you know what I actually don't wanna use the ID is I wanna use these values instead And then you need to create a custom import concept now we have tried to make that Easy as possible and yet I'm sorry to say that it's still quite complex So You basically go to custom import And then obviously there is a little warning here Because it is quite daunting You that there yes And it will load Into these areas The actual script That are used by Default In these various concepts Now if you do not understand what you seeing here Then I suppose you should rather not be trying to do this Or you shoot Then 6 mm Classes maybe from lynda.com or elsewhere I think you do me it's also a good place Sorrow sharpen up some of your PHP skills And Then you could make changes to this for example maybe just take out that junk And Then Do a search You know so put something in you can find like Your name or whatever And then save this and compile it And then go and search where does this come up Where does this come out what what is happening And then Obviously You'd realise that 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 to import methods next to each other It's not that easy but it's possible and it all depends on really What you doing and where is it now Safe area But This area the HTML and PHP View area So depends on what you do interview so currently this is set up to do your normal Import as you would usually do So changing this will also change your normal import concept Ok so That is how you would In this area you would Change your custom import concept Please read through the code Maybe compile it Go look at what it's done Look around see how the default import and Concept work And then make your changes accordingly I have used this area quite a lot for various applications Do sometimes you have a user that says to you or client I want to import these sets of Csv files I don't like forced 4000 door 40000 lines and it needs to select only specific values Well in that case this area is definitely what you looking for And you'll be able to actually adapt to 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 backend of your component Sanitary changing how that button behaves that how that one behaves
- 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