Linking one page to another is easy. Just like any other wiki you can
make a link with wiki markup you type:
[page:NNNNN]
into a cell where: NNNNN is the name of the page you want to link to
referencing cell data within a page is very easy too by using:
[cell:CR]
where C is the column letter and R is the row number. (e.g. putting
[cell:B3] into cell C5 takes the data from B3 and puts it into cell
C5.
... but I can't see a simple way to include data in a cell that is on
another page of my SocialCalc wiki. In other popular spreadsheets you
might use something like:
=Sheet4!B7
What I want is some simple transclusion code: [page:NNNN!CR] or
[page:NNNNN|cell:CR]
I've looked through the Wikicalc help:
http://www.wikicalc.org/products/wikicalc/helppagestext.html#cellediting
but can't see anything.
I guess I could use an wkcHTTP call - but that doesn't seem very user
friendly.
Any pointers or help much appreciated.
This is over-complicated if you just want to set the contents of one
cell point to another. In that case you would just use the normal
=B3
syntax.
> ... but I can't see a simple way to include data in a cell that is on
> another page of my SocialCalc wiki. In other popular spreadsheets you
> might use something like:
> =Sheet4!B7
Which is exactly what you would here, too. However, in testing this,
I've discovered that this kills Socialcalc 1.1.0 with
Undefined subroutine
&SocialCalc::Sheet::get_page_published_datafile_path called at
lib/SocialCalc/Sheet.pm line 6052
or "line 6006" in the current snapshot.
This is probably something else we broke in the split. Hopefully we'll
get that fixed soon.
Tony
Look forward to this being fixed!
Paul Y
This isn't as trivial as we thought, which is why we've spent some
time looking into it.
We've committed a fix to Subversion and discovered it requires
publishing before you can address data from other sheets.
We're not sure if that's correct behavior. Is that what you expected?
Perhaps Dan can shed some light here.
Download from Subversion to get this change. A snapshot will come
later, probably when we get this better tested and implemented, and
when we figure out the behavior.
Cheers,
--
Casey West
Page references in calculation always refer to published data, not
private, intermediate editing data.
-- start programmer-oriented details (assumes familiarity with the new
documentation about Sheet.pm) --
When parsing the formula for execution, the operands_as_coord_on_sheet
routine is used to put together the text on the left of the ! (the
"sheetname") and on the right. It uses operand_as_sheetname to get the
sheet name. If "sheetname" is a named value, then that value is
treated as the new "sheetname". If "sheetname" looks like a cell
reference (letter(s) followed by number), then the value in that cell
is used (e.g., A2!B7, with "demosheet" in A2). If it is text, then the
text is used as is (e.g., "http://..."!B7 or "demosheet"!B7).
Otherwise, the sheetname itself is used as text. That "sheetname" is
now looked up in the cache of sheets already read in using
find_in_sheet_cache to make sure that it exists. This then becomes a
cell reference for use in calculations.
When the cell reference is actually resolved, the find_in_sheet_cache
routine is used to find the data structure (%sheetdata) for the
referred to sheet. This looks for published data only -- either as
".txt" files on the Internet using "http://..." or in the current set
of pages using the page name.
-- end programmer-oriented details --
Why does SocialCalc use published data and not still-being-edited
data? The editing state is considered private, much as if it was being
edited completely in the browser with no saved intermediate files
(which is indeed the editing style used in the sample code in the
Javascript documentation -- there are no files for others to
reference). References in formulas can be in any other page, editing
or published, created by any other allowed user (who may not have edit
access to the referenced page). Also, more than one person can have
the page open for edit - which partially-edited page should be used?
Other models for this can be created by merely modifying the
find_in_sheet_cache routine. However, until you work out the entire
editing model for the system into which you are putting the Engine,
I'd suggest not changing this. SocialCalc as written is for creating
published pages. While editing, the being-edited-but-not-published
pages are treated just like being-edited-but-not-saved pages in a wiki
-- out of limits for other pages and users. When SocialCalc says
"published" think "Saved" in a wiki.
I hope this helps.