Copy Data from Search results to another items from block in Oracle Forms Builder - forms

Okay, I'm not sure if I can explain this well.
This is what it looks like at runtime:
The list of display items from above are the data that came from database query.
I put a 'When mouse click' trigger to every row so that when I click a row, it copies all the data to the field below. It works when I first try to click a row but when I click another row which supposed to change the data below, NOTHING HAPPENS anymore.
here is my canvas' variable names:
here is what's inside of the 'When mouse click' trigger:
thank you for the help!

Your mouse click code is not working because when you are clicking on search block then currently you are in that block so you should have to move to FLIGHT block before assigning the values also you have to move to next record to populate the values into new record otherwise it will rewrite the values on existing, below is the example given for your problem:
on mouse click add these lines before your code
Begin
Go_Block('flight');
loop
if flight.flight_id is null then
-- look for the empty record if found then exit and assign values
exit;
end if;
-- else continue finding empty record
next_record;
end loop;
end;
--- paste your mouse click trigger code below

I got it. This tiny line of code did the trick.
GO_ITEM(SYSTEM.MOUSE_RECORD);
it simply tells what row number the item you clicked inside the record is in. It gives a char value of zero '0' when you clicked an item outside the record.
For more uses of the SYSTEM variables, check this very useful link. Thanks!
http://oraclet.blogspot.com/2008/02/system-variables-toutorial.html

Related

LibreOffice BASIC function - Copy if over a value to a new sheet

I'm trying to create a simple function on a LibreOffice Calc sheet.
I have a table of information where cells A1:K2 has headings (the cells in Row 2 are merged)
all the information runs from A3:K176
The sheet has various functions running on it already, all I need is one more function.
At first I wanted it to automate when i open, but then i thought running the BASIC macro off of a button might be better, so i can edit and then just hit the button once I'm done.
I have the button linked up to run the macro already, but now im stuck... I have tried many ways of writing the code, but it seems that i am just too green to figure it out.
the last time i ran Excel advanced functions i was in high school.
ok, enough talking...
All I need the macro to do is once I hit the button, I need it to check column K and any value > 1 it needs to take that whole row and copy it then go to a target sheet, clear any data on the target sheet. then copy that set of rows to the next open row in the target sheet. possibly even exporting the result to a .txt file as a bonus.
this is a start...
in future I would like to add another button that will do the same function to a array lower down and put that into a different sheet.
Option Compatible
Sub SWD_AwakeningsTrade
Dim i, LastRow
LastRow = Sheets("Card_List").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Awakenings For trade").range("A2:I500").clearContents
For i=2 to LastRow
If Sheets("Card_List").Cells(i,"K").Value = "(>1)" Then
Sheets("Card_List").Cells(i, "K").EntireRow.Copy
Destination:=Sheets("Awakenings For trade").Range("A" & Rows.Count.end(xlUp)
End if
next i
End Sub

How can I show a specific record near the top in list view without screen flicker?

I have a script (in FileMaker 14) that sets a variable, $_record_number, to Get ( RecordNumber ) based on a specific criterion. Once it's been set, I want to bring that record to the top in list view. (It's possible that the criterion is never fulfilled and that $_record_number is empty.)
The portion of the script that does this looks like the following:
Go to Record/Request/Page [ Last ]
Refresh Window []
Go to Record/Request/Page [ No dialog ; Max ( $_record_number ; 1 ) ]
When the Refresh Window step isn't present, the script doesn't work correctly. Instead of bringing the record to the top of the list view, it brings it to the bottom.
Unfortunately, the Refresh Window step causes the window to flicker as the script redraws the layout.
Is there a way to duplicate the end results of the above steps without using Refresh Window and avoid the screen redraw?
Failed techniques I've tried:
Using Refresh Object instead of Refresh Window targeting objects in both the header and body
Using Go to Related Record with a relationship to the target record
If you're using FileMaker 13 or higher, you can try the Refresh Object script step instead of Refresh Window. See http://www.filemaker.com/help/13/fmp/en/html/scripts_ref2.37.62.html for more details on that specific step.
I've sometimes had issues refreshing portals without Refresh Window, but if you just need the text on a label or button to update when the variable does, it should work fine.
Chuck, one straightforward option would be to add an unstored calc field to your portal table, with a calc of Get(RecordNumber) = $_record_number. You could set the sort of your portal to reverse sort on this calc field. Since only the matching field should match, this should always pop the desired record (if any) to the top, and otherwise, this condition would be ignored.
Another option would be to manually step through your portal in a Loop and stop when you find a match.
Last, I'd wonder if it might be cleaner to store and test against your portal table's primary key instead of its record number, but that's of course beyond the scope of this question. Good luck :-)
I am in FM14, and I think this works: get rid of your lines that go to last record and refresh window and instead insert 'Scroll Window [ End ]', e.g.
Scroll Window [ End ]
Go to Record/Request/Page [ No dialog ; $recordNumber ]

Excel Form VBA Combobox reset

This should be easy but I can't seem to find anything to solve. I have a Form in Excel using VBA. The Excel sheet has four columns populated with data and the Form displays those fields.
The user then selects a value in a combobox, uses a command button to submit the responses and the values from the combobox are written to the Excel sheet.
The user then uses a command button to advance one row down in the spreadsheet and load the four values from a new row. This all works great.
The issue I am trying to solve is that the combobox remains selected to the value in the prior selection. I'd like to reset the combobox so nothing is selected and the user has to make a selection again for the next row.
Below is the code I am using to load the combobox and to set a variable for what the user selected. Can't seem to get the combobox back to it's default state after the user has submitted the form.
Private Sub cbDesAccWanted_Change()
Select Case cbDesAccWanted.Text
Case "Yes"
desacc = "Yes"
Case "No"
desacc = "No"
End Select
cbDesAccWanted.Text = desacc
End Sub
Private Sub cbDesAccWanted_DropButtonClick()
cbDesAccWanted.List = Array("Yes", "No")
End Sub
There are two ways to reset the combobox. Take your pick:
1
cbDesAccWanted.Value = Null
2
cbDesAccWanted.ListIndex = -1
the line
cbDesAccWanted.Text = desacc
is totally unnecessary.
Using cbDesAccWanted_DropButtonClick is not the right place to populate the list of values. This list should be set up when the form is first shown to the user.
(unelss the values it shows chnages in which case change it when the row changes or something, not when the user clicks on it)
So when theuser clicks the down arrow to move to thenext record include the following line
Me.cbDesAccWanted.text = Me.cbDesAccWanted.List(1)
Note (1) access teh 2nd item in the list which is No.
So this reset it to the default value of No.
Ok.

Powershell datagridview cell click event

I have a powershell script in that script i am using datagridview.
My script is working fine. All looks ok to me.
My issue is i want to get the first column value of selected row. To fulfill this i need to add event (cell click/cell content click/cell mouse click). I am not able to figure it out. How to add event.
Can somebody please advise me on this?
$datagridview1_CellMouseClick = [System.Windows.Forms.DataGridViewCellEventHandler]{
write-host $_.RowIndex # This displays the row number selected
write-host $_.ColumnIndex # This displays the column number selected
write-host $datagridview1.Rows[$_.RowIndex].Cells[0].value # This would display the value of the first cell in the selected row
write-host $datagridview1.Rows[$_.RowIndex].Cells[$_.ColumnIndex].value # This would display the value of the cell selected
}
There are plenty of example availble for C# but not found anything for powershell.
Not a stupid question at all, but a little confusing. You say you want the first column value of the selected row, however based on the output you are looking for it seems you are more interested in the selected cell. I am answering with the assumption that the selection of the cell is what you are looking for.
There are many possible events to work with here. The differences between them are subtle so I will leave it to you to see if there is an event that would work better for your purpose. For my answer I will stick with the event you mentioned: CellMouseClick.
I start by creating the function that I want to execute when the click occurs.
function gridClick(){
$rowIndex = $myGrid.CurrentRow.Index
$columnIndex = $myGrid.CurrentCell.ColumnIndex
Write-Host $rowIndex
Write-Host $columnIndex
Write-Host $myGrid.Rows[$rowIndex].Cells[0].value
Write-Host $myGrid.Rows[$rowIndex].Cells[$columnIndex].value}
Please note that you will have to decide how your variables are scoped and how the function will interact with the datagrid. If you are declaring the datagrid at the script level then you should be able to just reference it by name inside the function. This function will do what you said, in the exact order listed in your question. Edit to taste.
You can add the click event, after declaring your datagrid, like this:
$myGrid.Add_CellMouseClick({gridClick})
Note that the name of the function we created is placed within the brackets.
A few important notes:
There are many events to work with. While testing this out I tried the selectionChanged, click, cellclick, cellmouseclick, enterrow, and other events. You may want to check these out for differences in behavior.
The output may be a little unusual in some cases. For example the CellMouseClick event seems to respond to clicks in the header. So if I click on the cell at row index 1 and column index 1 (second row second column) the script will display the contents appropriately. If I then click on the column heading for the first column, the script will write the same results again (which makes sense because the selected index has not changed) which may seem confusing at first glance.
Keep in mind that datagrids allow for multiple selections and I do not know how that might effect the output. That is up to you to figure out.

delete selected item from text item

i have got multi lined text item like gridview in my forms project. i want to select an item and click delete button and the system must delete selected index but i didnt find the perfect function. it's not bind into the database so its not complicated i just want to delete the line from the text item. i tried to find the properties of the current record, i use some of loops but it didnt find the selected item index. does it have "selected item" function like c#, java. Or do i have to create a function to find selected item. which way is the best and how could i do that.
This code may help you(I didn't get a chance to test this) :
GO_BLOCK('Gridview_BLOCK_NAME');
GO_RECORD(record_index);
DELETE_RECORD;
GO_ITEM('block.delete_button');--if you want the cursor back to delete button