2 min read

Day Log: 2021-07-09

MS SQL Temporary Tables

I learned about Microsoft SQL temporary tables today. I needed to populate some reference data to update a SQL script that didn't exist in a table. I don't want to hold this data in the table, but within the SQL script and thought of the dummy data examples I learned when following a tutorial. Turns out it's really simple in MS SQL. You just prefix a table name with # and everything else works just as a regular table. The only difference is that the table will automatically clean up when you end your session. Also, the temporary table only exists in your current session window. The post on Introduction to Temporary Tables in SQL Server describes it very clearly and is an excellent reference.

SAP User Tables

SAP is designed on a great data dictionary. Internally the tables have technical names and technical field names. All of this information can be queried using SE16 Data Browser (personally, I prefer to call it the Table Explorer, has a nice ring to it). The data dictionary tables start with the prefix DD. The table DD03M stored a list of all fields and the human-readable screen descriptions of those tables by language. This is the go-to when exploring tables and trying to understand the various data and relationships between them. The two numbers after DD typically describe the data dictionary element type. So tables prefixed with DD02 have metadata about tables and DD03 ones have metadata about fields. Something similar has data about domains. Domains are sort of the ones we learned in Math. They are a superset of data types and hold the range of values that a particular type of field can hold. I'm probably butchering this explanation, but that is the current level of understanding I have.  

Of particular relevance to me were the tables about user data. Specifically USR02 that holds login related information about a user and USER_ADDR that holds more descriptive information about the user such as their name. Previously I was obtaining this information via a join between USR21 and ADRP on personnel number.

Data Attributes in Ghost Theme

Much of this week, I have spent time learning about Ghost Theme customization. It has been a fascinating exploration. Something that I had avoided so far because I felt it was more complicated than I needed to dive into. But it is surprisingly very accessible.

Among the various customizations I am doing, I want to use the new email segmentation feature automatically. I want to give my users the ability to subscribe to a very specific type of content they are interested in. I have embedded an email sign-up form. However, it's only capturing the email addresses. I learned that in order to send emails to specific user segments, I need to label them. I want to be able to assign different labels to users when they sign-up from a specific post.

This is when I discovered how the members feature of Ghost is using data attributes. It provides configuration through certain data attributes in a form and attaches certain classes such as loading, success, and error to the form automatically. I inspected how the theme I have was handling this and saw how the CSS was configured to show and hide the different buttons when they were clicked. The label adding attribute was mentioned in the documentation and should be a simple add. I'm also thinking of how I can automate the application of labels based on the tag of the post the visitor is reading. I will hopefully get around to doing this in the next few days. I enjoyed learning about this very clean mechanism using HTML5 data attributes and CSS trickery to achieve simple interactive behavior.