Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not the return value I expected
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00632457
Message ID:
00632482
Views:
10
browsed the cursor created and found that my field is sum_wrk_tlamt. thanks for pointing me in the right direction. I'm thinking now that it works that the init is not the best place for the code. Query runs when the form loads and pulls for the client where the record pointer was at the time. Changed client via the combo on the form but the query does not refresh. I'll look at that tomorrow.

Thanks

I tried the addition you suggested. I get "variable LASTYEARSALES not found"
I tried substituting INTO ARRAY aLastYearSales and setting the textbox value to aLastYearSales[1,1] and debug says "aLastYearSales.prg not found"

Locals window in debug is showing the type for curlastyearsales as L. I'm at a loss.

>You didn't specify the field name in the textbox value assigment.
>BTW, You don't need to compare result of 'Cdm30wrk.wrk_stat = "A-ACCTNG"' to the .t. because it's already logical value. There's also no need to ALLTRIM(Cdm30wrk.cmp_name) because foxpro compares the string on the left to the lenght of the string on the right.
SELECT SUM(Cdm30wrk.wrk_tlamt) AS LastYearSales;
> FROM  classicdb!cdm30wrk;
> WHERE Cdm30wrk.wrk_stat = "A-ACCTNG" ;
>   AND Cdm30wrk.wrk_page = 1;
>   AND Cdm30wrk.cmp_name = lcThisClient;
>   AND YEAR(Cdm30wrk.date_updt) = ldLastYear;
>into cursor curLastYearSales
>thisform.pgfClientDetails.pagAccountDetails.txtLastYearSales.value = curLastYearSales.LastYearSales
>
>>Please show me why this code returns what it does.
>>
>>local ldLastYear, lcThisClient, curLastYearSales
>>
>>***
>>
>>ldLastYear = YEAR(DATE()) - 1
>>lcThisClient = thisform.cboClientName.Value
>>
>>
>>SELECT SUM(Cdm30wrk.wrk_tlamt);
>> FROM  classicdb!cdm30wrk;
>> WHERE Cdm30wrk.wrk_stat = "A-ACCTNG" = .T.;
>>   AND Cdm30wrk.wrk_page = 1;
>>   AND ALLT(Cdm30wrk.cmp_name) = lcThisClient;
>>   AND YEAR(Cdm30wrk.date_updt) = ldLastYear;
>>into cursor curLastYearSales
>>thisform.pgfClientDetails.pagAccountDetails.txtLastYearSales.value = curLastYearSales
>>
>>This code is in the init of the form. Optimistic locking, table buffered private data session.
>>Instead of a currency amount I get F for any client I select on the form. I put a thisform.refresh in the LostFocus of the combo that selects the client to view.
>>
>>I tested the query (without form related variables) in the command window with a hard coded client selection and the query returned 1 record, a nice numerical amount. What is different? Is the Init the wrong place to place the code? Have I done something wacky with the assignments?
>>
>>Regards and TIA,
>>Matthew
Opportunity is missed by most people beacuse it is dressed in overalls, and looks like work --- Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform