cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
HLA
HLA
Level I

For loop without programming and coding

Hey there,

I have 3 columns (i, j, and k), could you help how to use the "for" formula (without programming and coding) to make a loop and link between these columns?

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: For loop without programming and coding

I'm afraid I still don't understand what your resulting column should look like.

 

You've written:

 

Z(i,j) = x * 5y;

 

and you've said that you want:

 

  • i to go from 0 to 90
  • j to go from 0 to 180

So, do you want your z column filled with:

 

z(0,0) = 0 * 5 * 0 = 0

...

z(90, 180) = 90 * 5 * 180 = 81000

 

As @Craige_Hales pointed out, the For() function isn't (generally speaking) appropriate for use in a formula column, nor is it required.

 

In this case you should use the Count() or Sequence() functions in an i column and a j column to  build a data table with your i and j sequences and then a z column with the formula:

 

i * 5 * j

Edit: Attaching a data table that shows Count() and Sequence() columns.

-Jeff

View solution in original post

7 REPLIES 7
Jeff_Perkinson
Community Manager Community Manager

Re: For loop without programming and coding

We're going to need some more details here about what you mean by "loop and link between these columns."

 

Can you share a mocked up example of the table you have and what you want as a result?

-Jeff
Craige_Hales
Super User

Re: For loop without programming and coding

The formula editor for the Z column is inside an implied loop that runs for every row in the table; you might be able to just write

x + 5*y 

as the Z column formula to get the x and y values from the same row.

Craige
HLA
HLA
Level I

Re: For loop without programming and coding

Thanks, but what about " i," and " j" values?
HLA
HLA
Level I

Re: For loop without programming and coding

I have attached the details, Sir.
Craige_Hales
Super User

Re: For loop without programming and coding

I'm not seeing attachments.

 

But now I'm imagining your table might be similar to this set of columns:

 

ILatitude  JLongitude  Temp  Wind  FeelsLikeCalculatedFromTempAndWind

 

where the lat/lon (i and j) have no bearing on the calculated value which is only depending on temp and wind. But you might want to use them on a contour plot of FeelsLike by lat,lon. If that's similar to your data, use a simple column formula for FeelsLike and then make the contour plot from lat, lon, FeelsLike.

Craige
HLA
HLA
Level I

Re: For loop without programming and coding

Untitled.jpg

Jeff_Perkinson
Community Manager Community Manager

Re: For loop without programming and coding

I'm afraid I still don't understand what your resulting column should look like.

 

You've written:

 

Z(i,j) = x * 5y;

 

and you've said that you want:

 

  • i to go from 0 to 90
  • j to go from 0 to 180

So, do you want your z column filled with:

 

z(0,0) = 0 * 5 * 0 = 0

...

z(90, 180) = 90 * 5 * 180 = 81000

 

As @Craige_Hales pointed out, the For() function isn't (generally speaking) appropriate for use in a formula column, nor is it required.

 

In this case you should use the Count() or Sequence() functions in an i column and a j column to  build a data table with your i and j sequences and then a z column with the formula:

 

i * 5 * j

Edit: Attaching a data table that shows Count() and Sequence() columns.

-Jeff

Recommended Articles