Section 14.15 of the PGF manual (pp 150-) describes the let operation. On pg 152 (first example) it is applied to saving coordinate (tuple values) to point registers p1 and p2 using the coordinate function to enable accessing computed coordinates outside the body of the let operation. It seems to me that it should be possible to save and reuse number registers in a similar fashion, but that does not appear to be the case. See proposed code below. I want to use the computed length \n1 as the length of the subrectangle DATASET, but this does not seem possible within the constraints of this syntax. Ideas? Workarounds?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows, positioning, calc}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5em}%
\begin{document}
\begin{tikzpicture}[auto]
\tikzstyle{file} = [ellipse, rounded corners, minimum height=1em, minimum width=1em, align=center, draw]
\tikzstyle{block} = [rectangle, rounded corners, minimum height=2em, minimum width=15em, align=center, draw]
\node [block, minimum height=10em] (DB){\textbf{Database}};
% Set coordinate points for sub-rectangles
% See pg 420 of 2.10 PGF manual for anchors
% 'let' is defined on pg 150 in Section 14.15 (The Let Operation)
\path
let
\p1 = ($(DB.east)$),
\p2 = ($(DB.west)$),
\n1 = {veclen(\x1-\x2,\y1-\y2)/2}
in
coordinate(p1) at (\p1)
coordinate(p2) at (\p2)
%number(n1) at (\n1) % illustrative syntax
;
% Use n1 for 'minimum width' instead of 2em
\node [block, draw, minimum width=2em] (DATASET) at ($(DB.north)!2/7!(DB.south)$) {Dataset};
\end{tikzpicture}
\end{document}
