Wrong result when using `ROW()` function inside a named expression
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu với các bản tái hiện được cung cấp trong named-expressions.spec.ts, sử dụng HyperFormula.buildFromArray và buildFromSheets với ROW() bên trong các biểu thức có tên. Chạy các ví dụ cơ bản và vừa phải, sau đó so sánh kết quả công thức trực tiếp với kết quả của các biểu thức có tên; hoàn tất khi cả hai tập assertion đều vượt qua với các giá trị tương đối theo hàng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
I am seeing unexpected results with Named Expressions.
Given an expression
const getRowExpression = "=ROW()"
And a Named Expression registered on sheet 0
engine.addNamedExpression('GetRowNumber', getRowExpression, 0)
The following usage returns different results
const engine = HyperFormula.buildFromArray([
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
])
A1:A5 => [0, 1, 2, 3, 4, 5]
B1:B5 => [2, 2, 2, 2, 2, 2]
I expected these values to be equal.
You can see a full example on JSFiddle (hyperformula-named-references-bug)
Or you can drop the following unit test into hyperformula/test/named-expressions.spec.ts on either the hyperformula::master or hyperformula:develop branches
describe('bug', () => {
it('basic example', () => {
const getRowExpression = "=ROW()"
const engine = HyperFormula.buildFromArray([
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
])
engine.addNamedExpression('GetRowNumber', getRowExpression, 0)
console.log(engine.getRangeValues(AbsoluteCellRange.spanFrom(adr('A1', 0), 2, 5)))
expect(engine.getCellValue(adr('A1', 0))).toEqual(1)
expect(engine.getCellValue(adr('A2', 0))).toEqual(2)
expect(engine.getCellValue(adr('A3', 0))).toEqual(3)
expect(engine.getCellValue(adr('A4', 0))).toEqual(4)
expect(engine.getCellValue(adr('A5', 0))).toEqual(5)
/* all the values in B are equal to 2 - maybe an issue with caching the named expression? */
expect(engine.getCellValue(adr('B1', 0))).toEqual(1)
expect(engine.getCellValue(adr('B2', 0))).toEqual(2)
expect(engine.getCellValue(adr('B3', 0))).toEqual(3)
expect(engine.getCellValue(adr('B4', 0))).toEqual(4)
expect(engine.getCellValue(adr('B5', 0))).toEqual(5)
})
it('moderate example', () => {
const accountLookupExpression = "=IFNA(VLOOKUP(INDEX(ledger!$A:$A, ROW()),accounts!$A:$B,2,FALSE()),\"\")"
const engine = HyperFormula.buildFromSheets({
ledger: [
[23, accountLookupExpression, "=AccountLookup"],
[30, accountLookupExpression, "=AccountLookup"],
[13, accountLookupExpression, "=AccountLookup"],
],
accounts: [
[23, "Office Supplies"],
[13, "Rent"],
[26, "Gas"],
[20, "Maintenance"],
[30, "Capital Improvements"],
]
})
engine.addNamedExpression('AccountLookup', accountLookupExpression, 0)
console.log(engine.getRangeValues(AbsoluteCellRange.spanFrom(adr('A1', 0), 3, 3)))
expect(engine.getCellValue(adr('B1', 0))).toEqual('Office Supplies')
expect(engine.getCellValue(adr('B2', 0))).toEqual('Capital Improvements')
expect(engine.getCellValue(adr('B3', 0))).toEqual('Rent')
/* all the values in C are equal to 'Capital Improvements' - maybe an issue with caching the named expression? */
expect(engine.getCellValue(adr('C1', 0))).toEqual('Office Supplies')
expect(engine.getCellValue(adr('C2', 0))).toEqual('Capital Improvements')
expect(engine.getCellValue(adr('C3', 0))).toEqual('Rent')
})
})
Steps to reproduce
- Run the provided JSFiddle (hyperformula-named-references-bug)
- Drop the provided unit test into
named-expressions.spec.ts.
Your environment
- HyperFormula version: 2.3.1,
hyperformula::master,hyperformula:develop - Browser Name and version: Chrome
- Operating System: Mac
- Ngôn ngữ chính
- TypeScript
- Star
- 2.8k
- Fork
- 174
- Merge trung bình
- 2 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của handsontable/hyperformula
-
[Bug]: SUBSTITUTE expands dollar sequences in replacement textCó thể đã có người làm @vera-rubin đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
handsontable/hyperformula#1808 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
handsontable/hyperformula#1803 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
handsontable/hyperformula#1793 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
handsontable/hyperformula#1745 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: ADDRESS returns "!R2C3" when sheetName is empty (should return "R2C3")Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởBug Impact: Low
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
handsontable/hyperformula#1641 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của handsontable/hyperformula
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
aws/agentcore-cli#2606 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-driven-qa bug Cosmetic
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-driven-qa bug claude Minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
linagora/twake-mail-admin#301 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
anomalyco/opencode#56038 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày