Just looking to be pointed in the right direction about how I should do this.
Background: Creating a program which will automatically fill out excel pricing files for our customers from our database based on the UPC. However, there's over a hundred different sheets because customers want them sent in their own format. Some in very weird formats. I don't want to hard code the columns/locations for UPC, price, etc. (sections that need to be filled out), as the sheets sometimes change and we get new customers. Therefore, I'm going to put the power in the users hands to map the locations of the UPC column, etc. I currently use excel interop in C# to do the excel file reading/filling out, however the mapping user panel is what I need help with.
What I would like to do: I'm comfortable with modifying an excel file in the background. However, I would like the mapping to work as such. I could easily say: "UPC Column Header" and the user puts in B10 in a text box and so on. What I would rather do is have the previous mappings for that customer in the text boxes, a check to see if the text is the same (same cell text value as before), and then an error if the column header cell text doesn't match the previous mapping stored in a db. I'm fine and dandy with the database portion to store/check the mappings, but here is my conundrum... and I may be putting more work on myself.
The conundrum is: I would like the user to be able to view the selected excel sheet and click on a cell to select a new mapping in the program, or to map a new excel sheet. So it would say: "Click the UPC header," and so on in order to fill out the mapping form. How would you go about this?
I'm a C#/ASP.NET web developer with decent Javascript experience and would like to keep it as a web app (to avoid having to update the program based on my changes for the user). However, I'm willing to go down different avenues/languages.
Related
I am currently working on a website, and would like to display data from an excel sheet on it.
Excel sheet format:
Each row contains an 'item', and each column contains properties of that instance of the item.
What I'm trying to do:
I'm trying to display an item (row in excel sheet of columns that I pick) one at a time to a user from the sheet, and upon clicking left or right buttons, it goes to the next or prev item.
I'd like to only display certain properties, so I'm not using all cols in spreadsheet(so if a row had an image in col A, a name in col B, and a summary in Col 3, etc)
So, my question:
How should I go about implementing this into my website?
I have read its possible use javscript to import excel data and manipulate it (so I guess I'd instantiate an object which contains the data I need from the sheet and display it on the website, each time the user clicks I would just replace the object)
I also read about importing the excel sheet into a database (mySQL), and then getting the data from the database and instantiating the object that way with PHP. I haven't learned SQL yet, but I read it's not too complex for simple things and I do plan on learning it regardless.
Thanks for any suggestions!
This thread may help you:
How to parse Excel (XLS) file in Javascript/HTML5
Personally, I hate working with excel sheets and convert them to csv whenever I can. Then parse the csv and convert the rows to JSON format.
With Handsontable, I use autocomplete columns to let users choose from a list of pre defined names. But when the user selects a name I don't actually store that name on my data object, I store an id connected to the name. The id is also what is available on the data when the table is loaded initially.
This means that I need a function to go from id to name and vice versa which I have. I use the id to name function in my renderer and I use the name to id function in beforeChange, so that the output contains the id.
Here is my problem:
If I select a cell with a name rendered and I press enter, I now see the id instead of the name. Is there some way I can change the behavior of the editor so that the name is shown instead of the id?
Everything else seems to work. If I for instance select a cell and start typing, it now contains what I typed and the autocomplete works as expected. I would like to have the same behavior when pressing enter on a cell.
I ended up using a solution where I do the translation on all the data when it is loaded. When I then extract data from the sheet I translate it back.
I encountered a similar problem with the date editor where I wanted to go back and forth between the user date format and our normalized date format. Handsons editors are not that easy to work with and especially the date editor receives dates in different formats on setValue.
The solution feels a bit hacky but at the same time there will only be on these two occasions when data is transformed which makes it less plausible that there will be any errors compared to if I were to transform on render, data entry, validation etc. With this solution I know that as long as we are in the sheet, the data is what the user sees.
I want to start by saying I'm NOT fluent in javascript, however, I am learning and can read the code and comprehend it. I make professional fillable PDF forms, using javascript to perform actions and calculations, but I've never had to do this before. My request is specifically for Adobe Acrobat XI Pro javascript.
I have an order form I created. I've added a button (called 'Create Invoice')on the page to adds a page (using:var a = this.getTemplate("Invoice");
a.spawn();) after the order form that presents the information that was entered or calculated from the first page. I ONLY want to show fields on the invoice that were selected on the first page.
Here's a screen shot [link] of a portion of the Order Form (pg 1):
[IMG]http://i61.tinypic.com/iqk3sm.jpg[/IMG]
(I can't post images until 10 reputation)
So on the Invoice (pg 2) I want ONLY the (2) items chosen above to show, in immediate succession:
[IMG]http://i58.tinypic.com/o59jt3.jpg[/IMG]
(I can't post images until 10 reputation)
The DESCRIPTION column will ideally concatenate the "Saddle Name" + "Color". The rest of the columns should be obvious (fill in with the associated fields for each item ordered).
So, what should the code look like for this? And should the Javascript be put onto a field or Document Javascripts?
(This is my first stackoverflow post, I apologize if I did anything wrong!)
So, the first page is a static page where the user fills the table as such. And the second page should have a well-ordered list of the ordered items.
The first page should be pretty straightforward, with hierarchical field naming (but it may be a good idea to have the line number not at the end (as Acrobat does when you multiply the selected fields), but in the middle of the file name(s). This would then allow you to handle lines in a much simpler way. The same principle would apply for page 2.
After spawning the second page, you loop through the rows on page 1, and if the number of items is not equal to its default, fill the table on page 2.
In order to be able to delete an order again, it might be useful to completely reset the table on page 2, and fill it up from new; here smart field naming will gain you a lot of time.
You would add that code (including calculation of totals etc.) in the Calculate event of a hidden field which is only used as a carrier for all calculations, including building totals etc.
My question is the following, is there any tutorial about how to make that when you begin typing on a google spreadsheet cell, the fields belonging to a custom list that contains (anywhere on the text) the typed characters appears in a drop down list.
I do not know a lot of Javascript, so if there's any book or reference where I can found something similar it would be really appreciated.
I am new, and I don't know of any method for allowing the selection of valid values
to be position based upon what the user starts typing (into a cell).
I know this cannot be done within a script. All scripts run after the user
has made all of their changes (to a cell).
You may already know about a drop-down validation list using defined ranges.
This process puts a small down arrow adjacent to the right-edge of the box.
It allows the user to select from a pre-defined list. It does not prevent
the end user from entering invalid values. It just marks their value as
invalid if it does not agree with one of the entries in the list. And
by pressing the down-arrow, the list of valid values is displayed. The
user can select an entry in the list by clicking on it.
I learned about this validation from the documentation. If that is all you need
then you can stop here.
To me the interesting thing about this validation method is:
you can define the list and give it a name. The invalid error message will include the name. You can use the name to indicate the type of validation error.
The list can be contained on a different sheet other than were it is referenced. The sheet that contains the list can be hidden.
If you add a row to the list area that is not the bottom row, (insert below) the spreadsheet engine will automatically adjust the size of the defined range. The new values entered in the list appear in the updated drop-down list (in the order that they appear in the range definition).
What I have not tested is expanding the list from a script. I don't
know if the spreadsheet engine will perform the same range modification
if the change comes from a script. I would hope that it would.
Also I don't know if you make a changes to a hidden sheet from a script,
then will the hidden sheet remain hidden. I know when you do a "copy sheet"
function from a script, the source sheet is temporarily made current,
and is therefore no longer hidden.
Hope this helps.
So I'm trying to implement similar functionality to Facebook where I am including information from YouTube should a users post contain a link, and when clicked it embeds the video.
I've accomplished it thus far, I'm just wondering how Facebook stores this information.
To me there are two options:
1) Have the post saved as normal (it is just plain text), and if the post contains a youtube link, append it on the fly in JavaScript whenever that content is viewed. However I know that when you post a link, Facebook gives you the option to change the title, description etc. Which leads me to..
2) Generate the HTML that would be otherwise appended when viewed and store it alongside the post at the database-insert level.
If so, doesnt that add a significant amount of information per post? What happens if you want to change the formatting of all youtube content within posts on your site later on? Each will be stored individually and seems like it would be a pain.
What is the best way to manage & engineer this sort of functionality?
Cheers,
I'd store the information itself in the database, but not as HTML. Generate the HTML on the fly but store the data in a separate place. If you don't want to add too many extra database fields consider storing the information in some serialized form (like serialize() in PHP).
Anyway I would always keep information separated and never store auto-generated HTML unless it's some sort of cache that can be re-generated.
If you want the user to include his video within his text, store the link in HTML within that user's intervention, and output it as is from the database on the page. Then your users can edit their posts to decide whether to place the video before, after, in the middle or not at all, and can change the details in HTML.
If you are showing the video in some standard way, then store the video link along with the post in a separate database column, and generate the HTML on the fly. You can have data in columns for size, colour etc..., but the flexibility will always be limited to what you decide to store: if there is a database coloumn for colour then you are letting the user choose the colour, otherwise... not.
So, the most flexible is to let your users type HTML. If you think they aren't up to it, or you want to limit their choices of what they can format, you could use a java(script) rich text editor of the type that you have in stackoverflow, wikipedia etc., with possibilities to edit text in certain chosen ways via buttons. You could also store the post in XML, say in a chosen subset of HTML5 (anything that is valid in a certain container...), and transform it at presentation time.
to me this sounds like a problem that was taken too far.
if you implement ckeditor in your post form,
it should resolve the problem ( if i understood it right ),
since in ckeditor you can embed an swf/flv,
and the output will be html.
that gives the editor the power to decide exactly where he want the video ( since he can add the link wherever he wants in the form ).
since the flv/swf come with its meta data from youtube, you dont need to save that data,
just the link to the video.