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 6886909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:49:07+00:00 2026-05-27T05:49:07+00:00

My DB generates 3000 lines for each process and I must count some values

  • 0

My DB generates 3000 lines for each process and I must count some values for a report.
the generated file is like this :

CREATE TTL:NAME=SMO:0/TTS:0/UPL:1,BLQ=TRUE,NAND:TRUE,EBSPWRC=ADAPTIVE,EMSPWRC=ADAPTIVE
CREATE GPL,ASSLAPD=TSM:37/LPDLM:0,
CREATE GPL,ASSLAPD=TSM:38/LPDLM:5,
CREATE GPL,ASSLAPD=TSM:41/LPDLM:1,
CREATE GPL,ASSLAPD=TSM:21/LPDLM:8,
CREATE TTL:NAME=SMO:0/TTS:0/UPL:1,BLQ=FALSE,NAND:FALSE,EBSPWRC=ADAPTIVE,EMSPWRC=ADAPTIVE
CREATE GPL,ASSLAPD=TSM:37/LPDLM:4,
CREATE GPL,ASSLAPD=TSM:21/LPDLM:1,
CREATE TTL:NAME=SMO:0/TTS:0/UPL:1,BLQ=TRUE,NAND:TRUE,EBSPWRC=ADAPTIVE,EMSPWRC=ADAPTIVE
CREATE GPL,ASSLAPD=TSM:38/LPDLM:1,
CREATE GPL,ASSLAPD=TSM:41/LPDLM:1,
CREATE GPL,ASSLAPD=TSM:21/LPDLM:7,

Actually I want to count CREATE GPL if the BLQ and NAND be true,
Also I wrote this method that read the file line by line :

public void getGPLCount(File f) throws Exception { 
    BufferedReader br = new BufferedReader(new FileReader(f));
    String line;
    while ((line = br.readLine()) != null) {
        if (line.startsWith("CREATE TTL:NAME=") && line.contains("BLQ=TRUE") && line.contains("NAND:TRUE"))
        //___//
    }
}

thnaks for your help …

  • 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-27T05:49:08+00:00Added an answer on May 27, 2026 at 5:49 am

    It appears as if Thomas’s answer is close, but misunderstood what you wanted. I’m just modifying his snippet.

    Something like this:

    int counter = 0;
    boolean countLines = false;
    while ((line = br.readLine()) != null) {
      if (line.startsWith("CREATE TTL:NAME=") && line.contains("BLQ=TRUE") && line.contains("NAND:TRUE")) {
        countLines = true;
      } else if (line.startsWith("CREATE TTL:NAME=") && !(line.contains("BLQ=TRUE") || line.contains("NAND:TRUE"))){
        countLines = false;
      } else if( line.startsWith("CREATE GPL") && countLines )  {
        counter++;
      }
    }
    

    So start counting every time we get BOTH BLQ=true AND Nand=true, and stop the counter if we get a TTL line missing one (or both) of those. Is this the logic you want?

    UPDATE:

    Matthew’s solution is also correct, but in pseudocode. Translating to Java:

    int counter = 0;
    boolean countLines = false;
    while ((line = br.readLine()) != null) {
      // test for TTL line
      if (line.startsWith("CREATE TTL:NAME=")) { 
        countLines = (line.contains("BLQ=TRUE") && line.contains("NAND:TRUE"))
      // if TTL told us to count and it's a GPL line
      } else if(countLines && line.startsWith("CREATE GPL"))  {
        counter++;
      }
    }
    

    His answer is cleaner because he doesn’t duplicate the startsWith("CREATE TTL:NAME=") like I did. In my defense, I was trying to get you a working java example and Thomas was extremely close to what you wanted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

InterfaceBuilder generates this method for me in fooAppDelegate.m: - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override
Our system dynamically generates a large report by converting many HTML pages into a
IIS 6.0 generates eTag values in the format of hash:changenumber. The changenumber goes up
I would like to create a mechanism for a User to keep track of
I am following this tutorial . All is going well until I try create
I would like to randomly generate numbers like: 3000 4000 5000 etc... between 3000
I'm trying to create user-generated posts. I know that the posts are being created
My web application generates pdf files and either e-mails or faxes them to our
My program generates relatively simple PDF documents on request, but I'm having trouble with
The following code generates the primaey key for the new record to be inserted

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.