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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:06:29+00:00 2026-06-10T17:06:29+00:00

In my design, I encounter a problem, that is: in database, Form table A,

  • 0

In my design, I encounter a problem, that is:

in database, Form table A, I defined a variable name “MyParams”, its value is “1,2,3”, or “2,3,5” or “5,6,9”, that is, the variable will change based on the business logic.

In powershell, below script will deal with some text splitted by ~, it will check if the columns which extract from variable “MyParams” in database is blank, if any columns with blank value, it will exclude this record.

    Get-Content "${myFile}.tmp" | Where-Object { $_.Split("~")[1] -ne "" -and $_.Split("~")[2] -ne "" -and $_.Split("~")[3] -ne ""  }|Out-File $myFile -Encoding ASCII 

here , the numbers (1,2,3) in $.Split(“~”)[1] $.Split(“~”)[2] $_.Split(“~”)[3] come from variable “MyParams” which is configed in database.

my problem is, the MyParams’s value is often change, How can I originize my above code to adjust this ?

I think maybe I need to use foreach-object inner Where-object , corrct? anyone can help me? thx.

  • 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-06-10T17:06:31+00:00Added an answer on June 10, 2026 at 5:06 pm

    well, I solved myself, I use the -and to combine all the arguments and return the bool value, have tested, this worked. below code sample may not work, you need to format it in one line, remove spare spaces.

    Get-Content "${sftpFile}.tmp2" | ForEach-Object {
    $line = $_.Split("~");
    $columnOverseeCount = $columnsOverseeList.Count;
    if($columnOverseeCount -eq 0)
    {
        if (($line[4] -ne ""))
        {
        [String]::Join("~", $line);
        }
    }
    else
    {
        $columnOverseeFlag = $true;
        foreach($columnOverseeValue  in $columnsOverseeList)
        {
            $columnOverseeFlag = $columnOverseeFlag -and  ($line[$columnOverseeValue] -ne "");
        };
        if(($line[4] -ne "") -and $columnOverseeFlag)
        {
            [String]::Join("~", $line) | Out-File -Append $sftpFile -Encoding ASCII
        }
        else
        {
            [String]::Join("~", $line) | Out-File -Append "${sftpFile}.filterByColumns" -Encoding ASCII
        }
    }
    

    }

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

Sidebar

Related Questions

Design of SQL Table Users: Columns: ID(Primary Key), Name, Age, Zip. I am displaying
There are a lot of design patterns and its pretty obvious that the patterns
Once again I was in a design review, and encountered the claim that the
Design an algorithm that, given a list of n elements in an array, finds
My design requires that I kill the get_configuration activity (Activity1) once the second_activity is
I've run into an easily solved but a design problem I've not encountered in
I encountered a code design problem while working on a small application. In terms
I encountered similar problem if statement vs OO Design - 1 but it is
I am using Lex and Yacc to design a parser and encounter some issue
I am about to design a database for a logging system. Many of the

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.