Link to home
Start Free TrialLog in
Avatar of ivan rosa
ivan rosaFlag for United States of America

asked on

assigning variable content into another

Hello Folks,
I'm still wrapping this around my head..., I'm writing some code as follow:

$VariableA = "computerA"
once the content is verified OK, a bool variable will set to $True.

$variableA will always change, so what  I want is $variableA content into a new variable w/o depending on the user, to be utilized for further commands..., as opposed using current content I want the one prior

Does anybody have any ideas on how go by?
thanks for looking! :)
Avatar of Qlemo
Qlemo
Flag of Germany image

I'm not sure that I understand what you are after, but my thoughts about having a persisting flag are
  • store a value in the registry
  • create a flag file in a location everyone to be icluded has access to
If you are targeting something different, please elaborate.
If you just want the the previous value of the variable, why not just set a new variable "$VariableB" and set $VariableB = $VariableA before changing the value of $VariableA again? If you want to go back and find what the value of $VariableA was under a specific condition, what you want to do is create a hash table. The key in the hash table would be the condition you want to find the value of $VariableA under. That could be data/time, the value of another variable, etc.
Avatar of ivan rosa

ASKER

I agree this is a bit confused... On my defense, this is my day 17 on learning C#, and my day 2 learning XAML/WPF (I'm using PS cause i have the most experience)...,  on pretty much my own... I'm just pushing my limits

On that note, I have a better illustration of the stuff I'm working on, with dets
See below

User generated image
thanks for looking into this :)
So, does your table contain multiple computers or the information from one at a time? If it is multiple, just create an array and have the computer name added to the array after the submit button is hit. You can then cycle through the array when exporting to CSV.
at the moment is for a single PC but I'll create another button for multiple PCs, I also created  a 'class' but didn't work out :( , do u have an example of what a hash table could look like ?
If it is for a single PC, I'm not sure what the issue is. When the submit button is hit, put the value into a variable, which will be available when when the export to CSV is hit. The value of the variable would only change if you were adding multiple computers to the table before exporting to csv.
After my own QA Test, I realized the "lingo" can break code and logic... therefore I re-did the menu, clean up the code and now it's fully working... 'Python' here I come,

nonetheless thanks for you guys swift responses

User generated image
I realized the "lingo" can break code and logic... therefore I re-did the menu, to much easier UI  inputs and solutions. After all this is just a fun personal challenge trying and testing different aspects involving C#, PowerShell, XAML/WPF

Again thanks for looking! :)
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.