How i can manage iterations in WTX reading a copybook - copybook

I have a copybook with an array of 30 products that I need to map to a XML message and a field that content the number of iterations that have information, but if there are not the 50 products some iteration come empty.
Actually I have a WTX map that map the array, but the map iterate over all the array even some iterations dont have information.
How can I map/validate only the iteration with information? Or how can i use the field en the copy book that indicate the number of iterations that have information to only map this ocurrences without go through all the array?

If you have a copybook with a fixed number of elements, all the elements are always there. That's how copybooks work - a fixed record size makes it easy to find a record's position in a file.
If you don't want to map all of them, you will have to add an IF testing for some condition telling you that the slot is not empty. Like whether part_number (or something) is greater than zero (or not blank, depending on your data types).

Related

How can I map each specific row value to an ID in Pentaho?

I’m new to Pentaho and I’m currently having an issue with mapping specific row values to an ID.
I have a data file with around 30 columns, one of which is for currencies (USD, GBP, AUD, etc).
The main objective is to have the user select up to 8 (minimum of 1) currencies and map them to a corresponding ID 1-8. All other currencies not in the specified 8 will be mapped with an ID of 9.
The final step is to then output the original data set, along with the IDs.
I’m pretty sure I’m making this way harder than it should, but here is what I have at the moment.
I have created a job where the first step is to set the variables for my 8 currencies, selectionOne -> AUD, selectionTwo -> GBP, …, selectionEight -> JPY.
I then have a transformation to read the data from the file and use the copy rows to result step.
Following that I have a second job called for-each which is my loop for checking the current currency in the row.
Within this job I have two transformations, one called set-current, one called map-currencies.
set-current simply uses the get rows from result step (to grab the data from the first transformation). I then use the set variable step to set the current currency to the value in currency field. This works fine, as each pass through in the loop changes the current variable to the correct value.
Map-currencies is where I’m having the most issues.
The goal is to use the filter row step to compare the current currency against the original 8 selected currencies, and then using the value mapper step to map it to an ID, before outputting the csv file.
The main issue here, is that I can’t use my original variables in the filter or value mapper.
So, what I’ve done here is use the get variables step to retrieve the variables and named them: one, two, three, …, eight. This allows me to bypass the filtering issue, but they don’t seem to work for the value mapper, which is the all important step.
The second issue is that when the file is output it only outputs one value (because of the loop), selecting the append option works, but this could be a problem if the job is run more than once.
However, the priority here is the mapping issue.
I understand that this is rather long, and perhaps a tad confusing, but I will greatly appreciate any help on this, even if it’s an entirely new approach 😊.
Like I said, I’m probably making it harder than it should be.
Thanks for your time.
Edit for AlainD
Input example
Output example
This should be doable in a single transformation using the Stream Lookup step.
Text File Input is your main file, Property input reads your property file into Key and Value columns. You could use a normal text file with two columns instead of the property input.
Below are the settings of the Stream lookup. Note the default value "9" for records that are not found in the lookup stream.

Create Word Search game in Visual Basic 2010

i want to create a Word Search game using Visual Basic? I've already started it by creating grids (10x10). However, I do not know how to properly insert the words that the user will search for.
Here's a look at what I did as well as the codes.10x10 grid
as you can I see, I created the grid using the Paint Event handler.
I have a text file containing all the words that the user will search. Using VB I open and read all the lines and put the words in an array (not seen in the picture).
I want the words to be inserted in the grid randomly. But I do not know how to?
Any help is much appreciated. Thank you!
The visual grid is a bit of a distraction at this stage. concentrate on getting a list of strings into an nxn two-dimensional string array. I would write a sub which, given a list of words and a dimension, returns a filled-in array (if possible).
A natural choice is a backtracking algorithm, which seeks to randomly place words into a partially filled array. For each new word, generate the collection of all valid locations and then randomly pick one of those locations. If there are no valid locations -- backtrack, removing the most recently placed word and placing it somewhere else. It might help to first sort the list of words to be placed in order of decreasing length, since it will be easier to place smaller words into a partially-filled in array than larger words. Placing the larger words when there are less constraints will thus lessen the amount of back-tracking needed.
When all of the words have been placed, fill in the rest of the array randomly.

Best way to handle multi-valued fields as a view/grid

In several notes applications, instead of handling related data as separate documents, if the size of the data is small (less than the 32k limit), I'll make several multi valued fields and display it in what I call a "List Panel". It's a table where each column displays one multi-value field. Since fielda(1) goes with fieldb(1) that goes with fieldc(1) there is a concept of rows. (I did a similar thing in my auditing routine discussed here )
It is always assumed that each field has exactly the same number of elements.
All the multi-value fields are then stored on the single document. This avoids several coding conventions that made my eyes bleed like having date changed, who changed it, new value fields for each field we wanted to audit. Another thing that this kept to a minimum was having to provide multiple fields for the same thing that locked you into a limit. Taxrate1, Taxrate2, Taxrate3, etc...
In my "Listpanel" the first column is a vertical checkbox. (One for each element in my lists) This is so I can select one item to bring up and edit, or select multiple values to delete "rows" or apply some kind of mass change to them.
What would be the best way to handle this under xPages to get this functionality? I tried making a table but am having the devil of a time to get the checkboxes to line up with their corresponding data items.
Views and dojo-grids seem to assume we're using a document for each row.....
This TableWalker may provide what you want http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Tutorial-Introduction-to-XPages-Exercise-23
It was created when XPages was all very new, so it's SSJS rather than Java. But if you're comfortable wiith Java, converting it probably won't be a challenge.
You could use a repeat control to display the values and build a table using the table row tags in the repeat. You would want to calculate the id of the checkbox to be able to take an action on that selected row. The repeat var would be just one of your multi-value fields and you use the index of the repeat to get the value for that row from the other multi-value fields.

Labview filling an array with data

I have code which generates an amount of data continuously and I'd like to store generated data in a 1-dimensional array.
How do I do this in LabVIEW?
Are you using the array to transfer data from your data acquisition to another location? If you know how many elements are in the array, you should first initialize the array to that size. Then you can place data in the array by using "Replace Array Subset". This way you're not continuously allocating memory. This also assumes that you're moving that data out of the array prior to the next instrument read.
In this case it is better to use while loop (if you know the exact number of data you can use For Loop as well, giving an N terminal defined number of iterations). Simply connect your generated data wire to the border of the while loop, right click it and choose Tunnel Mode:Indexing and you will get and array.

What is the best way to store and access static table data?

A real beginner here,
I am looking to have a table of static data with about 300 cells in it. (There will be 12 distinct tables in all)
The user would input two values, the first would indicate the row, and the second would point to the cell within that row, and I want my app to be able to read back the column heading for that row.
What is the best way to have this data stored in my app? Currently the data is in a spreadsheet.
The data looks like:
Index 0,Index 1,Index 2,Index 3 ,Index 4,Index 5,Index 6,Index 7,Index 8,Index 9
10,156,326,614,1261,1890,3639,5800,10253,20914
20,107,224,422,867,1299,2501,3986,7047,14374 ...etc.
Where the number at index zero is the name of the row (entered by user) and the numbers after that are the values also entered by the user.
I want the code to take the two numbers (row and value) and then return a string based on the column heading (shown here as index 0 - 9)
the last tricky bit is if the user enters a value that is in between the values give I want it to use the next highest value from the data. E.g. if in row "10" the user inputs 700 I want the code to return the index heading for 1261.
Does that make sense?
Possibilities are endless...
In code as a static 2D array
XML
JSON
Tab Delimited Text File
Comma Delimited Text File
PList
etc.
All depends on your needs and wants.
On the CONs for each:
Static 2D array may consume some memory every time the app runs...
A file will involve some disk IO or processing requirements to read the values out of the file stored in the Bundle.
On the PROs for each:
Data from the static array would be FAST...
Updating data in a file could be done on-the-fly over the web.
You could write a simple routine to dump your spreadsheet into any of the above listed options, so I don't think that's a real serious consideration. It's mostly about what works best for you in terms of size of data and updatability/maintainability.