![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Sat, Apr 12 2014 11:38 AM | Permanent Link |
kamran | Hi Just not getting what I need from the below code.
I have two indexes: product_promotion_end_start_date, product_promotion_end_date. so a product would have the respective dates filled in so as to provide a range for a current promotion based on dates. I need to select the products that are in range based on the database stored values e.g. just show products with a start promotion date of 01/01/2014 and an end promotion date of 31/12/2014. My Code: DataFrm.tbProduct.IndexFieldNames := PRODUCT_PROMOTION_START_DATE;PRODUCT_PROMOTION_END_DATE'; DataFrm.tbProduct.SetRangeStart; DataFrm.tbProduct.FieldByName('PRODUCT_PROMOTION_START_DATE').AsDateTime := StrToDate('01/01/2014'); DataFrm.tbProduct.SetRangeEnd; DataFrm.tbProduct.FieldByName('PRODUCT_PROMOTION_END_DATE').AsDateTime := StrToDate('31/12/2014'); DataFrm.tbProduct.ApplyRange; Any thoughts ! Regards Kamran |
Sat, Apr 12 2014 5:18 PM | Permanent Link |
Raul ![]() | <<
kamran wrote: I have two indexes: product_promotion_end_start_date, product_promotion_end_date. so a product would have the respective dates filled in so as to provide a range for a current promotion based on dates. I need to select the products that are in range based on the database stored values e.g. just show products with a start promotion date of 01/01/2014 and an end promotion date of 31/12/2014. My Code: DataFrm.tbProduct.IndexFieldNames := PRODUCT_PROMOTION_START_DATE;PRODUCT_PROMOTION_END_DATE'; DataFrm.tbProduct.SetRangeStart; DataFrm.tbProduct.FieldByName('PRODUCT_PROMOTION_START_DATE').AsDateTime := StrToDate('01/01/2014'); DataFrm.tbProduct.SetRangeEnd; DataFrm.tbProduct.FieldByName('PRODUCT_PROMOTION_END_DATE').AsDateTime := StrToDate('31/12/2014'); DataFrm.tbProduct.ApplyRange; Any thoughts ! >> I would actually create a single index that includes the 2 date fields. Haven't used ranges in a while but i think it relied on a single index. You can continue to assign fields to IndexFieldNames or in that case you assign the new index to the IndexName Raul |
Sat, Apr 12 2014 5:37 PM | Permanent Link |
Fernando Dias ![]() | Kamran,
It seems you are not understanding how ranges work - you can't set a range using 2 indexes. You can select the records you want using a Filter instead of a range. Like this: DataFrm.tbProduct.IndexFieldNames := 'PRODUCT_PROMOTION_START_DATE' ; DataFrm.tbProduct.Filter := 'PRODUCT_PROMOTION_START_DATE = ''2014-01-01'' AND PRODUCT_PROMOTION_END_DATE = ''2014-12-31'' ' ; DataFrm.tbProduct.Filtered := True ; -- Fernando Dias [Team Elevate] |
Sun, Apr 13 2014 2:50 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | kamran
Back when I was using DBISAM I very rarely used ranges, I generally used filters. Try that. Roy Lambert |
This web page was last updated on Monday, June 30, 2025 at 12:49 PM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |