Re: calc field question
Bill,
In the filter the left side of the equals is the the field or combnation of fileds that you want to compare to in the specified table. In your case you want to compare the Location_Code field in the Inventory table. So you simply say Location_Code = .
The right side of the filter is the value that you want to check the left side for. In your case you want that value to be that which is in the Location_Code field in the parent table of your form. If that value is a character type it needs to be in quotes. So if that value is 'A1' then the filter would be Location_Code = "A1". But you want to specify the value as a result of the Location_code field. You need to build this filter by adding the the value in Location_Code to the first half. Also the whole thing has to end up in quotes so it should like this - "Location_Code = 'A1'"
"Location_Code = " + Location_Code would give you "Location_Code = A1"
Since A1 is not in quotes the function will be looking for some variable called A1, which it won't find. So you have to get the A1 into quotes.
You could do this: "Location_Code = '" + Location_Code +"'" which results in this "Location_Code = 'A1'"
or you could this "Location_Code =" + quote(Location_Code) which gives you the same.
So the quote function is just to get the quotes right. Also check out s_quote() which is used for other data types.
What you place in the filter parameter of the function has to evaluate to something that the function can use against the specified table. So, as you noticed "Location_Code = Location_Code" when applied to the table will always be true because the you are simply comparing the field to itself.
When specifying the filter you place the actual final bits that you want the function to use in quotes. ie "Location_Code =" All the variable bits that you want to tack on to that filter you have to add to the parts already in quotes.
The expression knows that it needs to use the second Location_Code from the parent form not because it is in the quote function but because it was outside of the quoted section. The builder provides a clue by the color of the text. In mine the quoted parts are grayish and the the items that will be evaluated and used to build the filter are black.
Hopefully this helps and doesn't confuse.
Bill,
In the filter the left side of the equals is the the field or combnation of fileds that you want to compare to in the specified table. In your case you want to compare the Location_Code field in the Inventory table. So you simply say Location_Code = .
The right side of the filter is the value that you want to check the left side for. In your case you want that value to be that which is in the Location_Code field in the parent table of your form. If that value is a character type it needs to be in quotes. So if that value is 'A1' then the filter would be Location_Code = "A1". But you want to specify the value as a result of the Location_code field. You need to build this filter by adding the the value in Location_Code to the first half. Also the whole thing has to end up in quotes so it should like this - "Location_Code = 'A1'"
"Location_Code = " + Location_Code would give you "Location_Code = A1"
Since A1 is not in quotes the function will be looking for some variable called A1, which it won't find. So you have to get the A1 into quotes.
You could do this: "Location_Code = '" + Location_Code +"'" which results in this "Location_Code = 'A1'"
or you could this "Location_Code =" + quote(Location_Code) which gives you the same.
So the quote function is just to get the quotes right. Also check out s_quote() which is used for other data types.
What you place in the filter parameter of the function has to evaluate to something that the function can use against the specified table. So, as you noticed "Location_Code = Location_Code" when applied to the table will always be true because the you are simply comparing the field to itself.
When specifying the filter you place the actual final bits that you want the function to use in quotes. ie "Location_Code =" All the variable bits that you want to tack on to that filter you have to add to the parts already in quotes.
The expression knows that it needs to use the second Location_Code from the parent form not because it is in the quote function but because it was outside of the quoted section. The builder provides a clue by the color of the text. In mine the quoted parts are grayish and the the items that will be evaluated and used to build the filter are black.
Hopefully this helps and doesn't confuse.
Comment