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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:46:48+00:00 2026-05-27T02:46:48+00:00

I have a data stream with the following structure user_id (integer) user_name (string) The

  • 0

I have a data stream with the following structure

user_id (integer)
user_name (string)

The user_id is anything between 100 and 65536. I want to add a target_user_id (integer) field according to the following logic:

  • If user_id is in range 1000..9999, then let the target_user_id field be equal to the user_id
  • If not, then fill target_user_id with something in range 1000..9999 without causing a conflict. Preferably the lowest possible.

The length of the stream is under 9000. The user_id field is unique in the original stream.

  • 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-27T02:46:49+00:00Added an answer on May 27, 2026 at 2:46 am

    I am not sure what Kettle environment you are using but a general procedure could be as follows:

    1. Create a temporary database table (Maybe an in-memory database table)
    2. Initialise it with records with user_id 1000..9999 and user_name=null (use TableOutput)
    3. Open the input stream and process records with user_id 1000..9999 by updating the respective database record with the user_name. (use Update) Ignore all other records.
    4. Close and reopen the input stream
    5. Process each input stream record with user_id not in 1000..9999 by:

      • get the lowest unused user_id by executing a SQL query (DBLookup)

        SELECT MIN(user_id) FROM temporary_table WHERE user_name IS NULL;
        
      • Update this record with the current user_name (use Update)

    6. Read each record in the temporary database table with a non null user_name (use TableInput) and write to output stream
    7. Delete temporary database table

    Hope this helps

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

Sidebar

Related Questions

I want to do the following: facebook.Schema.stream_data data = api.stream.get(null, new List<string> { page_id
I'm considering the following: I have some data stream which I'd like to protect
I have a stream of data that I want to place into a container.
I have the following serialization method: Private Function SerializeData(ByVal data As cData) As String
I have a data stream that may contain \r, \n, \r\n, \n\r or any
I am in a Windows Desktop application and I have a data stream and
I have a byte stream that may be UTF-8 data or it may be
I have a DirectShow source filter for receiving a Network stream containing RFC2435 data
I often run into the problem that I have one stream full of data
Hello! My problem can be described the following way: I have some data which

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.