Post Reply 
Question about using programs in spreadsheet
07-27-2023, 05:12 PM
Post: #1
Question about using programs in spreadsheet
Hello everyone,
Does anyone know if it is possible to use a custom program from a spreadsheet cell?
I have looked and didn’t find any way to do it, but maybe I am missing something?

Thank you very much
Find all posts by this user
Quote this message in a reply
07-27-2023, 08:13 PM (This post was last modified: 07-27-2023 08:24 PM by froehlic.)
Post: #2
RE: Question about using programs in spreadsheet
If I understand that correct: You want to call a program inside a cell?

You can do that like this:
Code:

EXPORT FF_min(a, b)
BEGIN
  return IFTE(a<b, a, b);
END;

Now you can put your values for a and b in spreadsheet cells, lets say A1 and A2.
Define A3 as:
=FF_min(A1, A2)

The value in A3 is always the minimum of A1 and A2. This as a simple example. Your program can be whatever, for this special case you have to return a single object that can be stored in a cell.
You also can manipulate other cells in your program:

Code:

  Cell(1,11):=1;           // set cell K1 to 1
  Cell(1,10,7):= Col1;  // background color of J10 to color code Col1

Hope that's useful for you.
Find all posts by this user
Quote this message in a reply
07-28-2023, 02:14 AM
Post: #3
RE: Question about using programs in spreadsheet
(07-27-2023 08:13 PM)froehlic Wrote:  If I understand that correct: You want to call a program inside a cell?

You can do that like this:
Code:

EXPORT FF_min(a, b)
BEGIN
  return IFTE(a<b, a, b);
END;

Now you can put your values for a and b in spreadsheet cells, lets say A1 and A2.
Define A3 as:
=FF_min(A1, A2)

The value in A3 is always the minimum of A1 and A2. This as a simple example. Your program can be whatever, for this special case you have to return a single object that can be stored in a cell.
You also can manipulate other cells in your program:

Code:

  Cell(1,11):=1;           // set cell K1 to 1
  Cell(1,10,7):= Col1;  // background color of J10 to color code Col1

Hope that's useful for you.
This is great exactly what I was looking for, thank you very much
Find all posts by this user
Quote this message in a reply
07-29-2023, 08:00 PM
Post: #4
RE: Question about using programs in spreadsheet
(07-27-2023 08:13 PM)froehlic Wrote:  
Code:

  Cell(1,11):=1;           // set cell K1 to 1
  Cell(1,10,7):= Col1;  // background color of J10 to color code Col1

Hope that's useful for you.

Where is that use of Cell() documented? I cannot find it in documentation, manual nor does it work in a program. Where should it be used?
Find all posts by this user
Quote this message in a reply
07-29-2023, 09:38 PM
Post: #5
RE: Question about using programs in spreadsheet
It's in the online help under:

Main/HP apps/Spreadsheet app/Spreadsheet Variables/Cell References and Cell
Find all posts by this user
Quote this message in a reply
07-30-2023, 04:52 PM
Post: #6
RE: Question about using programs in spreadsheet
(07-29-2023 09:38 PM)roadrunner Wrote:  It's in the online help under:

Main/HP apps/Spreadsheet app/Spreadsheet Variables/Cell References and Cell

I'd like to look at it, what is the online help?
Find all posts by this user
Quote this message in a reply
07-30-2023, 05:41 PM
Post: #7
RE: Question about using programs in spreadsheet
(07-30-2023 04:52 PM)matalog Wrote:  
(07-29-2023 09:38 PM)roadrunner Wrote:  It's in the online help under:

Main/HP apps/Spreadsheet app/Spreadsheet Variables/Cell References and Cell

I'd like to look at it, what is the online help?

It’s the manual that comes in the calculator if you click help button


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
07-30-2023, 07:26 PM
Post: #8
RE: Question about using programs in spreadsheet
That's great, thanks.
Find all posts by this user
Quote this message in a reply
07-30-2023, 10:40 PM
Post: #9
RE: Question about using programs in spreadsheet
(07-30-2023 05:41 PM)nickapos Wrote:  
(07-30-2023 04:52 PM)matalog Wrote:  I'd like to look at it, what is the online help?

It’s the manual that comes in the calculator if you click help button
I assume he meant the On device offline help.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
08-03-2023, 07:12 AM
Post: #10
RE: Question about using programs in spreadsheet
(07-29-2023 08:00 PM)matalog Wrote:  Where is that use of Cell() documented? I cannot find it in documentation, manual nor does it work in a program. Where should it be used?

A little more details on that topic. If you only want to access a cell of any spreadsheet in a HPPL program or even in any other App or Homescreen you can use it like

Code:

 Spreadsheet.B3

Spreadsheet could be the "original" spreadshheet or any other new App based on spreadsheet. You can save a new spreadsheet i.E. as SpA (do not use a number at the end of the name!). Now you can access to cell C3 of that:

Code:

  SpA.C3

That is very important to use links inside a spreadsheet to other spreadsheets as you would like do in Excel.

BUT: If you want to loop through multiple cells in a spreadsheet, you have to use the cell function to access cells with a variable.For example:

Code:

LOCAL i;

FOR i:= 1 TO 10 DO
  SpA.Cell(i, 1):= i;
END;

This little example sets cells A1 to A10 to the sequence from 1 to 10. With that you can do all complex calculations on your spreadsheets.
Really ingenious about the Prime is the fact that you can use nearly everything from everywhere. As I said: A bug should be that you can't use Sp1.B2, this resolves in a error although you may name a spreadsheet Sp1!
Find all posts by this user
Quote this message in a reply
08-03-2023, 02:31 PM
Post: #11
RE: Question about using programs in spreadsheet
This is awesome and not intuitive at all. Someone needs to piece the puzzle on their own, of have it pointed to them. Thank you very much
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)