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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:13:34+00:00 2026-05-22T17:13:34+00:00

I am new to groovy.I am reading values for 2 variables from console with

  • 0

I am new to groovy.I am reading values for 2 variables from console with below lines of code.

System.in.withReader {   
  println "Version: "  
  version = it.readLine()  
  println "Doc Type:"  
  Doc=it.readLine()  
  call getBillID(version,Doc)
}

getBillid method is as below,

def getBillID(int version,int doc)
{  
  allNodes.BillID.each {
    theregularExpression=/\d+_\d+_\d+_\d_\d+_\d+_\d_${version}_${Doc}_\d+_\d+/
    if(it != "" && it =~ theregularExpression) {
      println "******" + it
    }
  }
}

now i want to use those variable values in my getBILLID method but i am getting error as

No signature of method: ReadXML.getBillID() is applicable for argument types: (java.lang.String, java.lang.String) values: [9, ]

where i went wrong.can any one tell me plz..

  • 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-22T17:13:35+00:00Added an answer on May 22, 2026 at 5:13 pm

    In addition to @Kalarani’s answer, you could also do this:

    System.in.withReader {
      print "Version: "
      int version = it.readLine() as int
      print "Doc Type: "
      int doc = it.readLine() as int
      getBillID( version, doc )
    }
    

    As an aside; I would be careful with your capitalisation and variable names, ie: you have a variable called Doc with a capital letter. This is not the standard naming scheme, and you are best using all lowercase for variable names. You can see where it has got confused in the getBillID method. The parameter is called doc (all lowercase), but in the regular expression you reference ${Doc} (uppercase again).

    This sort of thing is going to end up causing you a world of pain and bugs that might take you longer to find

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

Sidebar

Related Questions

I'm new to groovy, and I've used the ExcelBuilder code referenced below to iterate
In the Groovy console, the following code executes without error: class F { private
Using this code: xml = new groovy.xml.MarkupBuilder() xmldata = xml.Plugins(nextid: '10') { Target(name: 'default.auth')
I have the following Groovy code but it wont work: xml = new groovy.xml.MarkupBuilder()
getting two arrays from controller and code is -- Sql db = new Sql(dataSource_wldb1)
This is my Groovy code: // ... def xml = new XmlParser().parse(fileName) xml.each {
I'm new to groovy, and I'm reading the source of a project gretty import
I'm very new to Groovy. How can I list all variables I passed to
The following groovy script doesn't compile import java.util.concurrent.Callable println b; Callable<String> callable = new
I am kind of new to Groovy and I am trying to read a

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.