How to test for long text window? IW31 - sapscript

IW31
I have recorded a script for automation for ordering parts. It works very well, however, when I passed it to another person, it failed.
What I found was that he keeps his long text window collapsed, while I keep mine open. (I would have thought they would be the same control, but no.)
So, how to I test which long text window is displayed?
This is the collapsed long text window,
Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT").Text = "BENCHSTOCK"
While this is the expanded long text control.
Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/subSUB_TEXT:SAPLCOIH:1103/cntlLTEXT/shell").Text = "BENCHSTOCK"
I tried creating a variable to test it, but it tests True no matter the selection.
Set ShortComment = Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT")
'Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT").Text = "TESTING"
If IsObject(ShortComment) Then
Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/txtCAUFVD-KTEXT").Text = "BENCHSTOCK"
Else
Session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/subSUB_KOPF:SAPLCOIH:1102/subSUB_TEXT:SAPLCOIH:1103/cntlLTEXT/shell").Text = "BENCHSTOCK"
End If
Thanks in advance!

OK, I found a solution. It was a different approach than my sample code. I found the hint here.
The text field has a changeable property. If the long text field is extended, the regular field property CHANGEABLE=False.
By testing this property, I can ascertain whether the long field is extended or not.

Related

C1ReportDesigner subreport overflow to footer and not page breaking

I am working with C1ReportDesigner which I am new to it. I have a sub-reports embedded with main report. When a column in sub-report content is huge it doesn't page break, instead it overflows to footer. How to page break and continue in next page in C1ReportDesigner?
It seems that the KeepTogether property of the control within the subreport (having long text) is set to True. This property tends to keep the whole text together on a single page, hence ,at times, causing the overflowing of text over other sections.
Please make sure to set the KeepTogether property of Field (of Subreport) having long text is set to False.
Regards,
Mohita

Oracle ApexCreate Time field HH:MM

I am having difficulty with a duration field on my form/table.
The users need to indicate in HH:MM how long a meeting took.
What datatype should the column have in the Table. Currently it is TIMESTAMP
How can I make the field have an input mask of 'HH:MM'. What I would like is for the user to be able to type '0130' and the field format it to '01:30' immediately.
Reporting on these times is required so I assume that entering the data as VARCHAR will not help.
Honestly, this is not such an easy subject as people might think it is, and probably more from a user interface point of view than technically.
The easiest way out? The apex datetimepicker. And honestly, if you're new to the technology I'd advise you to use this, especially if you want to steer clear from javascript/jquery initially.
Let's put it this way: the datepicker is fine and works good, but time is really not that fantastic.
Not all that hot right. The value in the input item does not change until you hit 'Close'. The time component seems like a last second sloppy addition honestly. It works, however. (But I'd still set the field to readonly so that a user can not enter text directly.)
Allowing text to be entered means it needs to be validated according to the correct format mask. And format masks differ between those in jQuery (the datepicker) and those in Oracle, and it might be possible that your oracle format mask is not possible in the datepicker, adding even more complexity. There is also no 'live' date validation (nor datetime), there is only the builtin item validation which will check the format mask and which fires on submit.
Anyway, I'd say take a look at it. Set your item to be displayed as a Date Picker, and use the format mask under settings to get the datetime picker:
Now you can push it further of course, though it'll cost some effort. There are several options though.
Personally, when I've implemented date+time I've always split the date from the time in 2 fields. 1 with the date component, and one with the time component, while keeping the item with the original value hidden (so 3 items total). I then use the datepicker on the date item, and use jquery timepicker plugins on the time item. On submit I then add the 2 values together and parse them in a date, and put this value in the original item again (to allow the standard processing to work on items with source set to database column).
One example of a timepicker is here, another one here. They're both not that hard to implement. They have good documentation too. I don't want to dive in the implementation of it here though, I advise you take a look at it first and see how much it scares you. (I'd set up an apex demo but am a bit pressed for time at the moment).
For example, using Trent's (second link) plugin:
put the js file in the apex images directory. I made a folder "/custom" in my case
add the required js files to the page (assuming apex 4.2, put this in javascript file urls)
#IMAGE_PREFIX#libraries/jquery-ui/1.8.22/ui/jquery.ui.slider.js
#IMAGE_PREFIX#custom/jquery-ui-timepicker-addon.js
use onload code such as this to initialize a field
$("#P95_DEPARTURE_TIME").timepicker({hourGrid: 4,minuteGrid: 10});
It'll end up looking as this:
Any further interaction between pickers will need to be handled in javascript code if you want it live. Don't forget server validations.
As for items, my hidden date item has format mask DD-MON-YYYY HH24:MI. Format masks are important, because items are bind variables, and bind variables are varchar2. The value in the html form is also just that, text.
For example, this is on my displayed date item, with a similar setup for the time item:
Then in an after-submit computation I glue the values together again and put them in the m that'll save the value to the database:
:P95_DEPARTURE_DATE_DISP||' '||:P95_DEPARTURE_TIME
This is just a short guide on the setup though, but might be interesting once you're a bit more familiar with the product.
There are also 2 timepicker plugins on apex-plugin, but honestly I don't find them interesting at all when compared to these already existing fine jquery plugins.
Give it some thought and look at it.
If quarters are enough..
item: text field with autocomplete
SELECT ss|| ':' || dd ss_dd
FROM
(SELECT to_char(trunc(sysdate)+(level - 1)/ 24,'HH24')ss
FROM dual CONNECT BY level <= 24),
(SELECT lpad(mod(15 * level, 60), 2, '0') dd
FROM dual CONNECT BY level <= 4)
APEX 4.2: Just to shed some light for any future viewings; now there are loads of Apex plugins for the purpose of picking Date/Time or both returning variations of date time formats as you would required. For e.g. as in your case HH:MM or HH24:MI.
I have personally used TimePicker plugin from http://www.apex-plugin.com which I have no problem in recommending.

Qt - creating a complex "calculator"

I am building an application that requires a graphical interface for a calculation process.
The calculation is basically a formula written by the user to be evaluated with QScriptEngine - ie, Javascript.
The thing is I'm having trouble breaking down the problem into smaller steps. The general objectives are as follows:
The values that are to be used in a formula report to properties of items. The items are already created and have a list of properties with which I populate a QTableWidget.
By dragging/droping from the table to a QTextEdit, I'm creating a string with some rich-formating to help the users read the formula more intuitively. Basically, each item on the table has a certain color, so in the QTextEdit, when an item is dropped, it gets a background-color formatting with the same color, and displays the property's name; something like: <span style='background-color:red;'> propertyName </span>
The drag/drop interface as well as the formating is coded and working as expected. But now I have a few problems:
some items have properties with the same name. If I create the formula with two different properties (from different items) that have the same name, I can't track the property's value backwards without ambiguity - I was thinking of string compare/string replace the property's name with its value and then calculate with evaluate().
I have been breaking my head on how to get around this and I thought of creating a QMultiMap to hold the item: [property, value] relationships, and then, replacing on the string that will be evaluated. But again, I would need to check form which item the property came from, and I don't know how I can do that.
I'm new to Qt/C++ and I know that most of my code has some big faulty practices, and its being done more in the way of hacking my way through the objectives I require, more than building a good structure - so every new problem gets a more complex solution each time.
Even so, how would you suggest I should tackle this problem? By this time I think it is better to not post my code just yet, because it is too long (and probably painful) to look at. If someone requires a specific portion to better understand the context of the problem, let me know and I'll post here.
Also, I have had other question here in SO when I started to think about this - might be useful to check for context: here.
UPDATE:
In reply to #Riateche's comment:
Imagine this scenario:
Item A : [property1, value1]
[property2, value2]
Item B : [property1, value3]
[property2, value4]
Now, imagine the user wants to perform ItemA.property1 * ItemB.property1:
I want him to see property1 * property1 - but notice that the background-color of each should be different;
I could place in the QTextEdit something like: <span style='background-color:red;'> property1 </span> * <span style='background-color:blue;'> property1 </span>
what I actually want to evaluate (to calculate) is: value1 * value3 - in which these represent double types.
UPDATE 2
After thinking a little bit about this, while #Riateche's approach seems simple, I wasn't able to find a way change a tag's attribute (at least in rich text, maybe there is one with QWebkit, but that is not what I need). So I was thinking if building another string (that will be evaluated), at the same time the user builds a string with drag and drop. For instance, let's imagine the user drags and drops something like:
property1 * property1
At the same time I would build other string that contained
value1 * value3
And this would be the evaluated string. Even so, the problem with the user editing the string would still be there - if the user changes the drag/drop string, I need to update the evaluation string again -requiring me to once again check the origin of the data. Any other ideas?
You should put all information important for the formula evaluation to the text edit. You can make it invisible to user. For example, you can put the following to the text edit:
<span style='background-color:red;'><a name='Item A,property1'></a>property1</span>
The Item A,property1 text will be invisible to user, but textEdit->toHtml() result will contain it.

Make input field small?

I have a form based on a model. I create a modelformset and need to display many (possibly hundreds) of individual form fields on a single page. I need to reduce the input size and am achieving this by using this:
widgets = {
'm1_pf': forms.TextInput(attrs={'size':1}),
}
However, this smallest size of 1 is still too big. Is there some other way of accomplishing a data-grid like presentation?
I have looked at using a Datatable with "editable cells" but this will not work for my situation. I need to be able to enter several values quickly by entering the first value, hitting tab, entering the next value, hitting tab, etc. Using the mouse to "click" into each cell and edit it (as is how Datatables works) is out of the question.
Thanks
Nevermind -- I figured it out. I added this to my CSS sheet:
input {
width: 1px;
}
I am OK with all input tags having this value.

SetCurSel in CDateTimeCtrl

Can somebody please tell me how to set the cursor position in an MFC CDateTimeCtrl?
After somebody enters a date and presses an "Add" button, I clear my date control contents with m_Date.SetWindowText( "" ); The problem I have is that when tabbing back onto the control, it still shows the year as being highlighted. My date control is of the format DD/MM/YYYY
All I want to to is make the selected text the date (DD) rather than the last field (YYYY) selected.
Ideally, I would like to be able to get a CEdit* pointer to the control's textbox. That way I could use CEdit::SetCurSel() and everything would be fine.
Cheers
I think its safe to say it can't be done. I ended up writing my own control to do the job as have other people as well.