Min ( var1 ; var2 ; var3 )
But the OP wanted to return the variable name not just the smallest value
This might work:
var1=6; var2=2; var3=11;
smallest = Min ( var1 ; var2 ; var3 )
Case ( smallest = var1; "var1"; smallest = var2; "var2"; smallest = var3; "var3"; "error" )
A recursive custom function may be more extensible.
was hoping for something a little more slick and generic as the variable values do change ...
His answer is generic for any values, values are embeded in the calculation only for testing (and you wrote variable names without $ and $$, so usable only in Let() function itself).
Do you want generic for variable names, or count of variables?
What do you want if two or more variables have same lowest value?
And, don't you get the values from records?
And if two variables have the same lowest value?
What are you really trying to accomplish here? What do these variables represent in real world terms? How are they created and what is the data in them? Why do you want to know the lowest value?
There is likely another way to accomplish what you want.
The numbers are the length of 8 lines of text. I want to add more text to the shortest line.
Agreed. This is an example where people are trying to help but there is not a lot of information to go on. You will likely get better answers if you explain what you are trying to achieve rather than pre-empting what the best solution might be.
So, sokol, what are you trying to do?
For example, if you have eight lines of text in a field separated by return characters, you can probably find out where to insert the text without the variables you first mentioned.
There are some smart people here who will likely provide a 'slick and generic' answer when they know what you are doing
Let's see if I can explain my self better! I have 8 distinct variables for many records:
that contain text from 50 to 100 characters long forming a block of information to be read. Occasionally I need to add more text and I would like to automatically add it to the shortest of the 8 lines. Is that explanation making my issue clearer? Thanks!!!!!
I feel more hard to get you.
"Each records" have 8 distinct "values" in a field, or 8 values are in 8 fields?
"variable" need to be defined each time when file open ($$), script run ($), calculate (Let(var=val;)) etc., so your "information" may be stored in field, not variable.
let me try another approach as my terminology was not correct. Each record has 8 FIELDS. These are separate and the layout has each of them on a separate row to make reading the record easier. At times I need to add more text to one of the fields ... and I would like to add it automatically to the one that has the fewest characters:ap1ap2ap3ap4ap5ap6ap7ap8sorry for the confusion and misusing variable ... it should have been FIELDS.
Let's step back another step.
If the fields are interchangeable and it never matters WHERE you put this data; what is this data anyway?
What is this all about?
What is the purpose of this database solution?
this data is discussion with a client. it is regarding many things we have chatted about. Each line (field AP1 ... AP8) starts with an activity and then a description (for example: Running
go on treadmill for 30 minutes daily) ... after 8 topics are discussed, sometimes there is a 9th one ... so I would like to add that topic (for example: Meatonce weekly) to the shortest topic already discussed to make sure there is room on the line and it looks nicely spaced.
The best way to do this is to use a separate table with a record for each discussion rather than fields. You can have any number of discussions that way, 8 or 9 or 20.
Sorry I'm stuck with the eight fields stacked on top of each other, for every record. When all eight records have text in them, at times I have to add a bit more text to the shortest field.