Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3450988
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:06:07+00:00 2026-05-18T09:06:07+00:00

I’ve got an odd and persistent problem… (Also my right shift key just stopped

  • 0

I’ve got an odd and persistent problem… (Also my right shift key just stopped working, so please bear with my possibly odd caps & symbols; trying to get my fingers trained to use the left shift key is a pain.)

I’m running a CalcFields event when a ClientDataSet opens & goes through records (ie, AutoCalcFields is true). It takes every record and does a little modification to it, as in a field comes in with “88”, it changes it to “$88.00” and puts it in a new field, and so on for formatting purposes. This works great, the only problem is that CalcFields seems to completely ignore the first record in the set. It shows the records in a DBGrid and the first record is there, but none of this formatting has been done to it. So I step through the code and CalcField never touches the first record. Well, actually, it DOES touch the first record, (I’m assuming). When I step through the code, CalcField fires off twice with two completely blank sets of information. I know CalcFields is executed when the dataset is open, and stepping through, that’s where the first blank input comes from, which is fine. The second blank input comes in first when it’s going through each record. Again, the first record shows up perfectly intact in the DBGrid, but completely blank on Calcfield.

Does anybody have any idea on why this is happening? This is driving me crazy and I’ve tracked it up and down and can’t figure out what the heck is going on.

Here’s the CalcField code, for what it’s worth:

void __fastcall TDataModule1::sdsSEARCHCalcFields(TDataSet *DataSet)
{
        // to view for debugging.... 
        DataSet->FieldByName("MISBN")->AsString;

       AnsiString formattedField;
       String field;
       double dInputPower;

       dInputPower = DataSet->FieldByName("MBILL$")->AsFloat;
       formattedField = FormatFloat("#,##0.00", dInputPower);
       DataSet->FieldByName("BILL")->Text = formattedField;

       dInputPower = DataSet->FieldByName("MTGUID")->AsFloat;
       formattedField = FormatFloat("#,##0.00", dInputPower);
       DataSet->FieldByName("GUID")->Text = formattedField;

       field = DataSet->FieldByName("MISBN")->AsString;     
       int lght = field.Length();
       String str = field.SubString(14, 1);
       if (field.Length() > 13 && field.SubString(14, 1) == ".")
       {
            DataSet->FieldByName("ISBN")->Text = field.SetLength(13);
       }

}
//---------------------------------------------------------------------------

and here’s the code that executes it. note that it’s a ctQuery…

DataModule1->sdsSEARCH->Active = false;
DataModule1->cdsSEARCH->Active = false;
DataModule1->dsSEARCH->Enabled = false;
DataModule1->sdsSEARCH->CommandType = ctQuery;
DataModule1->sdsSEARCH->CommandText = queryStr;
DataModule1->sdsSEARCH->Active = true;
DataModule1->cdsSEARCH->Active = true;
DataModule1->dsSEARCH->Enabled = true;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:06:07+00:00Added an answer on May 18, 2026 at 9:06 am

    why not use the DisplayFormat property? for example, in in a TClientDataSet.AfterOpen event do something like this:

    dynamic_cast<TNumericField*>(DataSet->FieldByName("quantity_to_date_adjustment"))->DisplayFormat = "#,##0.00;(-#,##0.00)";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i got an object with contents of html markup in it, for example: string
I've got a string that has curly quotes in it. I'd like to replace
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I want to count how many characters a certain string has in PHP, but
I have a JSP page retrieving data and when single or double quotes are
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.