Dynamic reference in vlookup - match

I have a formula like this:
=VLOOKUP(A14,Cars!C25:S49,17,0)
I would like to know if the below is possible:
The numbers 25, 49 which are specified in the Range of the above vlookup were present in different cells. I.e.,
C3 = MATCH(.....) --> Match results in the number 25
C4 = MATCH(.....) --> Match results in the number 49
I tried something like this:
=VLOOKUP(A14,Cars!C&C3:S&C4,17,0)
But this shows the error. Can someone suggest me how to achieve this?

An alternative to the volatile Indirect() can be achieved with Index along the lines of
=vlookup(A14,Index($C:$C,$C$3):Index($S:$S,$C$4),17,false)

You need the function INDIRECT. In your case,
=VLOOKUP(A14,INDIRECT("Cars!C"&C3&":S"&C4),17,0)

Related

Line that loads based on the value of a variable in Flutter

I try to explain to you as best as possible what I need. I would like to create a line with the style similar to the loading ones like this:
and to be able to decide the initial and final value (for example start at 0 and end at 100) and advance the line according to the value of an int variable.
So if for example I create a line from 0 to 100 and put the value of the variable at 50 it should be half full.

Is there is 'if integer' or similar statement in Crystal Reports?

I'm trying to find a way to check if the result of a calculation in a formula is a whole number (integer) when divided.
I have had a look through the functions present in Crystal, but I cannot find anything along the lines of what I am looking for.
So far my code looks like the below
If {#recordnumber} / 12
//is an integer (not a decimal) | Here is where i am stuck as how to do
this
Then opNo12 else
So ideally say the record number is 144, or any other multiple of 12, I want the formula to return opNo12.
If anyone can clear up if this is possible or alternatively point me in the right direction for a solution it would be greatly appreciated.
Thanks
Try something like this:
if Trunc({#recordnumber}/12) <> ({#recordnumber}/12)
then
opNo12
else ""
IF {#recordnumber} mod 12 = 0 Then opNo12 else ""

AS400 Macro, input fields count

5250 emulator:
Hello everyone, I want an operator which will count that input fields as it is shown on attached picture. In this case i have 5 input field.
Thanks in advance and best regards
It can be done!
Download this source: http://www.code400.com/ffd.php
You can comment out the GETKEY section from FFDRPG as you won't need that and it will probably cause it to fall over anyway.
Also, rememember when you use the command, to put the record format name in as well as your display file name - don't just leave *FIRST in there or you'll just get the fields from the first record format in the display file.
EDIT:
You'll need to add an extra field to the ListDs data structure:
D ListDs DS
D SfFld 1 10
D SfType 11 11
D SfUse 12 12
D BufferOut 13 16B 0
D FieldLen 21 24B 0
D Digits 25 28B 0
D Decimals 29 32B 0
D FieldDesc 33 82
If you add the 3rd field SfUse, you can check whether it contains 'I' so you only count Input Capable fields.
Check out the QUSLFLD API https://www.ibm.com/support/knowledgecenter/en/ssw_i5_54/apis/quslfld.htm if you want to see exactly what information can be retrieved by this API.
The example in the download uses the most basic format FLDL0100 but more information can be retrieved if you ask for format FLDL0200 or FLDL0300 but they will take longer to execute and you shouldn't need the extra info to achieve what you're after.
I'm not sure if this is possible, but you might find some joy with the DSM APIs.
QsnQry5250 has a maximum number of input fields return parameter, but it may just show you the maximum allowed on the display rather than the number you have on your screen.
There's an example here https://www.ibm.com/support/knowledgecenter/en/ssw_i5_54/apis/dsm1g.htm
And the API documentation here https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/apis/QsnQry5250.htm
Sorry I can't be of more help - I've never used those APIs and can't think of another way to achieve what you're after.
If you tell us the reason you need to know the number of input fields on screen, we may be able to suggest another way to achieve what you want to achieve.
Damian

How to convert "like each" into a functional form?

Let's say I have a column of a table whose data type is a character array. I want to pass in a functional select where clause, where the column is in a list of given strings. However, I cannot simply use (in; `col; myList) for reasons. Instead, I need to do the equivalent of:
max col like/: myList
which effectively gives the same result. However, I have tried to put this in functional form
(max; (like/:; `col; myList))
And I am getting a type error. Any ideas on how I could make this work?
A nice trick when dealing with this problem is using parse on a string of the select statement you want to functionalize. For example:
q)parse"select from t where max col like/: myList"
?
`t
,,(max;((/:;like);`col;`myList))
0b
()
Or specifically in your case you want the 3rd element of the result list (the where clause):
q)(parse"select from t where max col like/: myList")2
max ((/:;like);`col;`myList)
I even think using this pattern in your actual code can be a good idea, as functionalized statements like max ((/:;like);`col;`myList) can get pretty unreadable pretty quickly!
Hope that helps!
(any; ((/:;like); `col; enlist,myList))
it should be: (max;((/:;like);`col;`mylist))

Crystal Formula to exclude if value does not contain a certain format

I'm trying to exclude any value from a certain field (table.value) that does not match this format AA#####A. Example if they entered APT12345T, or PT12345PT and No Value then I want to exclude it from the report. It needs to match example AP12345P. What selection formula can I use to accomplish this.
Any help is greatly appreciated
Thanks in advance.
try reading Crystal's help topics on the mid() and isnumeric() functions.
here's an example from the help file:
Examples The following example is applicable to both Basic and Crystal
syntax:
Mid("abcdef", 3, 2)
Returns "cd".
so, in your case, you want to strip your value into three pieces,
mid(table.value,1,2)
mid(table.value,3,5)
mid(table.value,8,1)
and build up a three-part boolean variable where:
the first piece is not numeric(), or between 'AA' and 'ZZ', or however
else you want to test for letters,
the second part isnumeric(), and
the third part passes the same test as the first part.
where are you getting stuck?
something like this:
not isnumeric(mid({table.field},1,2)) and
isnumeric(mid({table.field},3,5) and
not isnumeric(mid({table.field},8,1))