mP1 / walkingkooka-spreadsheet

Building a web based spreadsheet application server & rich web app
Apache License 2.0
6 stars 2 forks source link

BasicSpreadsheetEngine.loadCell fails to load cell with label after updating target of label #1658

Closed mP1 closed 3 years ago

mP1 commented 3 years ago

SpreadsheetEngineExpressionEvaluationContextExpressionReferenceExpressionFunction

line: engine.loadCell fails to load A2 returns nothing.

    @Override
    public Optional<Expression> apply(final ExpressionReference reference) {
        Objects.requireNonNull(reference, "reference");

        final SpreadsheetCellReference cellReference = SpreadsheetEngineExpressionEvaluationContextExpressionReferenceExpressionFunctionSpreadsheetExpressionReferenceVisitor.reference(reference, this.labelStore);

        final SpreadsheetDelta delta = this.engine.loadCell(cellReference,
                SpreadsheetEngineEvaluation.COMPUTE_IF_NECESSARY,
                this.context);

        final SpreadsheetCell cell = delta.cells()
                .stream()
                .filter(c -> c.reference().equalsIgnoreReferenceKind(cellReference))
                .findFirst()
                .orElseThrow(() -> new ExpressionEvaluationException("Unknown cell reference " + reference));
        final SpreadsheetFormula formula = cell.formula();
        final Optional<SpreadsheetError> error = formula.error();
        if (error.isPresent()) {
            throw new ExpressionEvaluationException(error.get().value());
        }

        return formula.expression();
    }
mP1 commented 3 years ago

Invalid was working with A1, B1, C1 not A1, A2, A3, confusion over columns/rows