Naming website strings - naming

There are 2 types of strings in any website:
Shorter with no formatting (menu items, section titles, labels...).
Longer with formatting (content).
If you have to store these 2 types of strings in 2 different database tables, how would you call these 2 tables?

Labels
Content

In SQL the shorter ones are generally called varchar and the longer ones text.
That's not to say that you'd never put HTML in a varchar, just that text fields are better suited for arbitrary-length strings.

Localization strings?
Content
In short, call the tables after their content.
If you have both application texts, content titles and content you might use three tables, "ApplicationTexts", "ContentTitles", "Content".

Related

Converting grouped /nested data table to tabular form

I have been trying to covert tables that I get in the grouped format as in the picture to tabular form to make it pivotable. I have tried to use power query but not sure how to do it. I am not sure where to start and I appreciate your guidance as to where to start or how to make it
if you want to use powerquery, Assuming those are spaces, your best bet is probably to add some custom columns that check the number of leading spaces from column one to determine the level. For example,
= if Text.StartsWith([Column1], " ") then Text.Trim([Column1]) else null
then do something similar but with different leading space counts into separate columns, and then fill down to populate a table
You could alternately try to split the column on, lets say, 3 spaces, depending on what the indentions are. (0/3/6/9)

Column to rows and highlight difference between values in the same group

I have a huge table with data structured like this:
And I would like to display them in Spotfire Analyst 7.11 as follows:
Basically I need to display the columns that contain "ANTE" below the others in order to make a comparison. Values that have variations for the same ID must be highlighted.
I also have the fields "START_DATE_ANTE" and "END_DATE_ANTE" which have been omitted in the example image.
Amusingly, if you were limited to just what the title asks, this would be a very simple answer.
If you wanted this in a table where the rows are displayed as usual, and the cells are highlighted, you can do this by going to properties, adding a newGrouping where you select VAL_1 and VAL_1_ANTE and add a Rule, Rule type "Boolean expression", where the value is:
[VAL_1] - [VAL_1_ANTE] <> 0
This will highlight the affected cells, which you can place next to each other. You can even throw in a calculated column showing the difference between the two columns, and slap it on right next to it. This gives you the further option to filter down to only showing rows with discrepancies, or sorting by these values.
However, if you actually need it to display the POSTs on different lines from the ANTEs, as formatted above, things get a little tricky.
My personal preference would be to pivot (split/union/etc) the data before pulling it in to Spotfire, with an indicator flag on "is this different", yes/no. However, I know a lot of Spotfire users either aren't using a database or don't have leeway to perform the SQL themselves.
In fact, if you try to do it in Spotfire using custom expressions alone, it becomes so tricky, I'm not sure how to answer it right off. I'm inclined to think you should be able to do it in a cross table, using Subsets, but I haven't figured out a way to identify which subset you're in while inside the custom expressions.
Other options include generating a table using IronPython, if you're up to that.

Excel Dependent Drop Down List with Repetitive Values

I have some data stored in an hierarchical way like this:
And I want to create three drop down lists from where you can select the Product in the Category based on the Store,Something like this:
The tricky thing here is the fact that a product(i.e Frozen Pizza) can be found on both stores while others (Lays) can only be found on one store.
How can I achieve this or how can I store the data in such a way that I can have the same result?.
I've tried things like named range with the data stored in a table like structure and with =INDIRECT (but won't work because of illegal characters like spaces,symbols,etc in the named range).I am looking for a Formula not a VBA.
I think you were on the right track. If not using VBA, I would use data stored in a table with named ranges and the INDIRECT formula.
That approach would be arduous as you would have to build out each list in its own range (e.g. products in category 1 of store 1, products in category 2 of store 1, etc.).
Also, as you mentioned, the named ranges are strict, so you would need to convert spaces and symbols to _ or omit them completely. You could consider using numeric IDs in the drop down lists instead of text, but the user would need to know what the IDs represent. You could then translate the IDs back to text using a lookup table once selected.
VBA would certainly provide a better solution.

How to handle raw data where a column may contain more than 1 entry per row?

I have some data I would like to export (happens to be from Ruby, but that's unimportant) into a generic format for further analysis. Unfortunately, some records/lines/data entries may contain greater than 1 value (or 0, for that matter) for a given column.
For example, a person may be wearing sunglasses AND a hat. There are multiple columns like this.
I'm not sure how to handle collections of data that ideally could fall under the same column in a generic format (I need to import this data into other software, ideally including Excel).
The only simple, generic method I can think of is to have a column for each potential piece of data and treat it as a boolean. But I'd rather not, since then I would end up with over 300 columns. And then I'd also have to include a secondary CSV file that specified which columns belong to which categories.
If you want to output that data to a csv file, you could group the data into one field using a different separator:
John,sunglasses|hat,other,fields
Or using the same separator, but then the field needs to be quoted (and quotes already inside the field would need to be escaped with another quote):
John,"sunglasses,hat",other,fields
Or, if the number of other fields is not large, you could use a row for each value:
John,sunglasses
John,hat
Or you could use xml:
<record>
<name>John</name>
<options>
<option>sunglasses</option>
<option>hat</option>
</options>
</record>
It all depends on how you want to process the exported data.

Combining rows of long text from Excel for text analytics use

This is sort of related to Outputting Excel rows to a series of text files
Similar to he has asked previously, I have a slightly more complex dataset on my hands.
Each row in Excel for me is a paragraph, and I have a column for the text, a column that states the document ID, as well as an order ID(smallest to largest).
I would like to concatenate the the text for each document ID together, with line breaks in between. However, some documents are so long that it will exceed the Excel character limit.
I also have a series of variables that describe the document, title, dates etc.
I have tried to use google spreadsheet or openoffice, but it does not seem to work either.
How can I perform this "vertical concatenate"? I am ok with either one huge CSV file, a collection of text files, or maybe an Access file?

Resources