Progress 4GL display to a variable - progress-4gl

I'm working with a codebase that has multiple display statements. So that all of the outputs line up, the various column numbers are also typed multiple times.
I would like to just use a variable for the column instead of searching for the line and then updating the column width. Something like:
def var i as int init 10.
disp "FOO" to i
"BAR" to i + 5.

If I understand it correctly, you either want to have your frame defined dynamically and at the end so you can assess what the max size for that column is, or you want to define a static frame beforehand, it usually makes it respect the positions (but you won't be able to change it).
Now I was a little thrown off by your code because it has nothing to do with setting the column widths, looks like you're trying to write something different if you're on a specific part of the page. So you might want to look into a few printing functions such as FRAME-DOWN and FRAME-LINE.

Related

Change a Variable's Name in Matlab's Workspace

I have a problem that has more than likely been asked before but I have yet to find a solution that works for me.
I would like to know if it's possible to change the name of variable within a workspace in Matlab?
The need for this is a follows,
I have a small section of code that imports over 60's columns of data from Excel into Matlab, each column has over 10,000 rows in, so a fair amount of data. Row 1 of each column is the variable, i.e. R1C1 = "Time from X to Z" I would like to know if its possible for Matlab to create a Variable called "Time_from_X_to_Z" then store all the data in that Variable from the excel sheet. I am able to store all the data in separate variables, I just need a bit of help naming the variable.
I would like to name the variables like so, as when I come to re-use the code the order of the column may change from time to time, hence why I can't just let Variable1 = Varibale1 etc.
Here is some of the code I have tried from my research.
VariableName = txt(1,i);
VariableName = num2str(cell2mat(VariableName));
VariableName = Variable
clear Variable
This was my most successful one but is nowhere near what I expected it to be.
I hope that all makes sense.
Thanks for any help you are able to provide.

Define variables in loops using loop indicies [duplicate]

I have a process which is repeated on a set of data stored in separate folders. Each time a certain folders data is processed I need new variable names as I need to results separate after the initial processing is finished for more processing.
For example at the start of each new block of the repeated function I declare sets of arrays
Set_1 = zeros(dim, number);
vectors_1 = zeros(dim, number);
For the next set of data I need:
`Set_2 = .........`
and so on. There is going to be alot of these sets so I need a way to automate the creation of these variables, and the use the new variables names in the function whilst maintaining that they are separate once all the functions are completed.
I first tried using strcat('Set_1',int2str(number)) = zeros(dim, number) but this does not work, I believe because it means I would be trying to set an array as a string. I'm sure there must be a way to create one function and have the variables dynamically created but it seems to be beyond me, so it's probably quite obvious, so if anyone can tell me a way that would be great.
I'd not do it like this. It's a bad habit, it's better to use a cell array or a struct to keep multiple sets. There is a small overhead (size-wise) per field, but it'll be a lot easier to maintain later on.
If you really, really want to do that use eval on the string you composed.
The MATLAB function genvarname does what you want. In your case it would look something like:
eval(genvarname('Set_', who)) = zeros(dim, number);
However, I would follow the recommendations of previous answers and use a cell or struct to store the results.
This sort of pattern is considered harmful since it requires the eval function. See one of the following for techniques for avoiding it:
http://www.mathworks.co.uk/support/tech-notes/1100/1103.html
http://blogs.mathworks.com/loren/2005/12/28/evading-eval/
If you insist on using eval, then use something like:
eval(sprintf('Set_1%d = zeros(dim, number);', number))

iTextSharp 7 wrapping and no wrapping

Is it possible to manage wrapping of text?
I have a long string, longer than a cell, in a paragraph. If it is in form "ABCDEFGHIJKLMN", will be displayed on a line (row) of text. But if it is in "ABC DEFGH IJKLM" form, it is wrapped in two lines. How could be forced to stay on one line?
In a comment the OP clarified
I would like the cell to expand. Anyway, the no wrapping idea comes out of many pages on the Internet saying it wouldn't wrap if no wrapping spaces are used. I don't know if it did, it doesn't do this anymore ...
The iText 7 Table with its default TableRenderer renderer class only supports fixed column widths which can be given by
a fixed table width and a single integer, the number of columns,
a fixed table width and an array of relative column widths, or
an array of absolute column widths.
Thus, what those many pages on the Internet say, does not seem possible.
That been said, the iText 7 architecture allows to set a custom next renderer. Thus, it might be possible to introduce a certain amount of dynamic behavior, in particular some automatic cell resizing, if you implement a table renderer to do so.
Such a custom renderer is likely to run into problems, though, whenever code makes use of the ILargeElement interface Table implements because then the first cells will have to be layout'ed before all cell contents are known.

LibreOffice, Using Constants as query Parameters

I'm using the VLOOKUP function to move data from one table into another. I need to apply this formula to an entire column, and I need to know how to define certain parameters as variable and some as constant.
Here's my problem:
=VLOOKUP($D8,Sheet2.A1:B20,2)
becomes, when I drag the corner of the cell across multiple rows,
=VLOOKUP($D8,Sheet2.A1:B20,2)
=VLOOKUP($D9,Sheet2.A2:B21,2)
=VLOOKUP($D10,Sheet2.A3:B22,2)
=VLOOKUP($D11,Sheet2.A4:B23,2)
And what I need is
=VLOOKUP($D8,Sheet2.A1:B20,2)
=VLOOKUP($D9,Sheet2.A1:B20,2)
=VLOOKUP($D10,Sheet2.A1:B20,2)
=VLOOKUP($D11,Sheet2.A1:B20,2)
With the first parameter changing and the rest remaining constant. I'm sure there is an easy way to do this, but searching and browsing help topics is returning nothing. I admittedly have zero background in spreadsheets. Thanks for your help
Add more $ signs, like this:
=VLOOKUP($D8,Sheet2.$A$1:$B$20,2)
https://help.libreoffice.org/Calc/Addresses_and_References,_Absolute_and_Relative

Setting different Cell-Formats in a Matlab uitable

I am looking for a way to handle different type of data in one column of a Matlab uitable.
Usually uitable is used to set whole columns to the same data type, such as logical (gives a checkboxes), char (gives left-aligned text), numeric (gives right-aligned number) or a 1xn-cell-array (gives pop-up menus with different choices).
It is set using the columnformat property of uitable, e.g.
columnformat = {'numeric', 'logical', {'Fixed' 'Adjustable'}}; % 3 columns
You can find an example at matlab documentation.
I am looking for a way to set the format for single cells to realize something like this:
Matlab's uitable is a crippled version of an underlying JIDE table.
It is possible to get to the underlying java (see findjobj in file exchange), but that requires a lot of work. Yair Altman's undocumented matlab site is a good starting place for understanding the java side of matlab.
It sounds like you want something like a property editor, as opposed to a generic UI table -- i.e. properties listed in first column, property value editable in second column. There are a few "off the shelf" versions in the file exchange, which use JIDE:
See propertiesgui, or property-grid for mostly functional examples. The second example is easier to use -- you simply provide a class or struct, and it creates the proper field entry format. The first one offers more choices -- like color boxes, drop downs, etc, but requires you to be more involved in specifying how things behave.
I had the same problem, but in the end it worked by giving the (numeric) cell an (char) initial value. When changing the char value from the UI the format of the cell remained char, although the rest of the column was numeric.