vineetu1
28th July 2009, 07:50
Hi,
I want to display total of records which from table which are filtered by ttstpqbf.
e.g.
Suppose there is a display session (multi occurance) and the underliying table is having 1000 records. Now when the user uses ttstpqbf on the display session the resulting no of filtered records is 100.
What I want is to get total value of a numeric field of those 100 filtered records. I tried the main.table.io after.read option but it totals only the no of occurences displayed on the screen.
I think I have to get the value of filters defined in the ttstpqbf field and then write a function on that. Or some other way.
zardoz
28th July 2009, 12:29
All external variables and functions are traced with bic_info6.1 (for Baan IV).
You can try to understand the bic_info6.1 ottstpqbf output
vineetu1
29th July 2009, 06:32
Hi Zardoz,
I am trying to understand the bicinfo of ttstpqbf but, not sure how to identify the correct variable.
I guess I need to identify the correct variable and use get.var() to get its value ?
zardoz
29th July 2009, 09:22
I think (but I'm not sure) that somewhere there is a string that contains the 'where' part of the select, or the query.extension$ passed to the calling session, but it's only a supposition. Sorry, you have to experiment with this. Try putting the calling session in debug mode and see if the query.extension$ variable is filled after the filter.
george7a
29th July 2009, 11:50
The variable "query.extension" is empty in both the display and ttstpqbf sessions. I have just checked that.
However, there must be away to know at least what is the query.. but I did not figure it out yet..
zardoz
29th July 2009, 12:10
Yes, I have checked already. Also, I have put in debug mode a display session and put a simple query to filter the data.
When running the session, I have tried the "L" option that lists all the variables in the session, but I didn't find a string in that that contains the query I've done.
I suppose that the standard session uses a dynamic SQL query and in some way the ottstpqbf changes directly this query internally. If this is the case, there is no way to 'intercept' the where statement and use it in the calling session to do a query that counts or sums the current filtering of the data.
vineetu1
29th July 2009, 12:11
The variable "g.field.parts" is storing the value of qbf.
But need to handle the string.
zardoz
29th July 2009, 12:19
Can you put there, by example, what is the content of this array?
vineetu1
29th July 2009, 12:27
If for example I have put two conditons in ttstpqbf,
i.e.
Var1 = X .. string
Var2 = 123 .. numeric
then the field g.field.parts contains |Var1 = X@y@|Var2 = 123@y@|
refer screen shot
vineetu1
29th July 2009, 12:38
guess need to use dynamic sql to use these string values ?
zardoz
29th July 2009, 12:53
Yes, I think it is the right solution.
vineetu1
29th July 2009, 13:11
there's an issue on how to use data types of string in dynamic sql ? The variable g.field.parts it is not enclosing the string variable values in quotes (" ").
It is required that all the string vaiable values are enclosed in quotes ("")How can that be achieved ?
zardoz
29th July 2009, 13:22
You have to declare:
const AP """" | 4 times "
You have to extract the value to be assigned, check if is a string (pay attention to the DATE() function, must not be enclosed in ") and enclose this part like:
value = AP & value & AP
and then modify the condition
Then, all the filtering conditions are to be concatenated with " and ".
vineetu1
30th July 2009, 05:32
how to check whether its a string ?
vineetu1
30th July 2009, 06:47
I am trying to use values in ttadv301 to determine what is the domain for the form field, but surprisingly the fields ttadv301.pacd and ttadv301.cdom are blank for customized forms.
But when I see help in form ttadv3106s000 it points to fields of table ttadv301.
Can anybody comment on this..
manish_patel
30th July 2009, 07:15
how to check whether its a string ?
You can use rdi.column() function to retrive the database type. For example, DB.LONG, DB.FLOAT, DB.STRING, and so on.
http://www.baanboard.com/programmers_manual_baanerp_help_functions_runtime_dictionary_information_rdi_column
george7a
30th July 2009, 12:43
I was (and still am) interested in the way the both processes communicate. I will summarize what I have found in the following points:
1) The two sessions (the main one & the query) use BMS Messages to communicate.
2) A predefined variable in the main session called "bms.sender.process" and it contain the pid of the query session.
3) A predefined variable in the main session called "bms.sender.command" that I am not sure what it is used for, but it contained the value 5500.
4) A predefined variable in the main session called "bms.sender.argument" that I am not sure what it is used for, but it contained the value 3.
P.S. The three variables are long type
P.P.S There is another variable that is called bms.answer(1) (type string fixed based) That I couldn't get to it's value
- George
vineetu1
30th July 2009, 14:40
Hi Manish,
Where can i find what numeric value is assigned to which data type.
After debuging I found
string = 6
date = 7
enum = 11
zardoz
30th July 2009, 16:16
You don't need to know, just check the constants:
DB.BYTE, DB.DOUBLE, DB.ENUM, DB.INTEGER, DB.STRING, DB.BITSET, DB.LONG, DB.DATE, DB.COMBINED, DB.FLOAT, DB.TEXT, DB.MULTIBYTE, DB.TIME
for your purposes:
if type = DB.STRING or type = DB.MULTIBYTE then
| Put " before and after the value
endif
vineetu1
31st July 2009, 05:26
Hi Zardoz,
I am using function rdi.column() as suggested by Manish. In that function the variable type returns a long value
long rdi.column( string column_name(18), ref string domain_name(14),
ref long offset, ref long size, ref long dept,
ref long type, ref long flag, ref string default_val(.) )
hence i needed to know what data type is assigned what long value..
I was wondering where would it be defined ?
manish_patel
31st July 2009, 06:00
You don't need to worry about what is the value of that constant. Just use that constant directly as suggested by Zardoz.
Yes I agree; we should know where that constant are defined.
vineetu1
31st July 2009, 06:37
ok thanks..