How to modify a record within a record type in oracle forms - oracle10g

I created 3 blocks in my oracle 10g form, Headers, Lines and Lines Details. I am fetching the records using cursors for all the three blocks everything is working fine. Now in Lines Details block there is a numeric field called priority. By default I am using FIFO method for priority value starting from 1 to n numbers. Now I want user to decide the priority such that any specific record can be shifted up or down to increase or decrease the priority without committing line details. Once user is satisfied with priority he will click on save to commit the changes. Please help me with this. Thanks in advance.

Locate the changed record and based on the current priority value make it current priority +/- number of times user clicked Up or Down. Declare a record type variable with exact number of columns as in your lines details data block. Copy the all records including the changed record into record type variable. Clear block with no validate and then re-populate the changed record. To shift the record as per the priority values modify your default order by clause. This will solve your problem.

Related

How to update database and let delay block reference delay duration to updated value?

I have created a UI page for user to input the delay duration in edit boxes for certain activities at the simulation screen. The input values should update the database value and amend the delay duration. However, while the database does get updated, the delay block in the main screen keeps capturing the non-updated database value (eg. initial database value is 100, then a user inputs 200. The database value updates to 200, however, my delay block still captures 100.) Is this an issue with AnyLogic database or am I using it wrongly?
You need to specify in the unique result formula that you do not want to make use of the cached result.
(This image is from the local AnyLogic help, you can search for "uniqueResult". I could not find it on the new online help.
The default value is to use true, i.e. use the previous value that was retrieved from the DB for the same query
Simply add false as the first argument in your uniqueResult() code.

How to capture the last record in a file

I have a requirement to split a sequential file into 3 parts, Header, Data, Trailer. I have the header and Data worked out.
Is there a way, in a Transformer, to determine if you have the last record in a sequential file? I tried using LastRow() but that gives me the last row for each node. I need to leave parallelize on.
Thanks in advance for any help.
You have no a priori knowledge about which node the trailer row will come through on. There is therefore no solution in a Transformer stage if you want to retain parallel execution.
One way to do it is to have a reject link on the Sequential File stage. This will capture any row that does not match the defined metadata. Set up the stage with the metadata for your Data rows, then the Header and Trailer will be captured onto the reject link. It should be pretty obvious from their data which is which, and you can process them further and perhaps even rejoin them to your Data rows.
You could also capture the last row separately (e.g. via head -1 filename) and compare that against every row processed to determine if it's the last. Computationally heavy for very little gain.

PGSQL: Trigger counter of rows of another table

I want to make a trigger that when a table, let's call it A, is updated, it counts the number of rows on A and updates a value in another table B, how can it be done?
There is full sample here:
http://www.postgresql.org/docs/9.3/static/plpgsql-trigger.html
To create stored procedure you are supposed to provide:
CREATE FUNCTION your_function_name(parameters_goes_here) RETURNS returned_data_type_or_trigger_for_triggers AS string_value_with_body;
Normally semicolon ends command, so you can't type body. Other databases changes command delimiter. PG allows special string delimiter dollar signs. Please read more at this topic:
What are '$$' used for in PL/pgSQL
Going back to counters - they are tricky. Let's say you count posts in topics. And moving posts between two topics. Since they have counters, topics are updated. That in turn means update lock. What would happen if there are two concurrent posts moved between two topics? First move locks his base topic and tries other one. And the same happens to other one. :D
To deal with it you need to ensure that both of them tries with the same one. For instance sort topics by ID and pick first of them.

ExpressionEngine missing channel entries

I am working on a new web app which is based in ExpressionEngine and for the most part I am basing the content on channel entries. However I am experiencing some very weird issues with the exp channel entries tag in that it is not returning all relevant entries each time. I can't figure out what's going on with it as the entries are definitely available when viewing them in the control panel, and they will also show up as requested in my template, but sometimes they just disappear and/or are not processed properly. This is the case for large and small sets of entries also, ranging from 3 channel entries which fit the criteria specified within the exp tag to 500 entries.
Any thoughts or feedback would be greatly appreciated.
There could be a number of things going on here so here are some things to look at, just in case;
If the entries have entry dates in the future - you'll need your channel entries tag to have the parameter show_future_entries = "yes"
Likewise if the entries are closed, or expired, you'll need to add show="open|closed"
Are you looking at a particular category and these entries aren't assigned to the category?
Are you looking at a particular category but have exlcuded category data from the entries tag
Are you retrieving more than 100 entries? There is a default limit of 100 entries returned unless you specify a limit parameter.

When a teacher add an assignment, all the student names appear. How to do it?

I have a task to create a database to track student results in a school. I came out with a set of relationships between the tables according to the 3 forms of normalisation(I hope I got it right. If not, please enlighten me).
One feature that I want to put in the Filemaker app is that when a teacher want to enter some assignment marks, he will just need to create a new submission record and all the student names in the class will appear.
I could not think how this feature can be done in Filemaker. I can only create a new submissions record and key in a student's score, then create another new record to do the same thing for a second student.
Can someone help? I am a teacher, not a Filemaker developer so please correct me if my database tables are done wrongly.
Update:
I will like the output to be like this
Spreadsheet is not suitable because it can't be used to search/sort easily.
I have a quick sample file here. It's an old sample and it uses a different (but similar) model. Basically the idea is that: You have a calculated field (I use a repeating field) to display the data. You also have a global repeating field that serves as an editing widget. Each time you go to a record you fill this field's reps with data from related records (using a OnRecordLoad trigger). This doesn't mean the field shows the same data for all records, because its conditional formatting rules are set to hide all data; so it only shows a piece of data when you actually enter one of its repetitions. This is the data that can be edited. And finally there's a trigger that fires each time you exit the field and posts your changes to the related table (adds, updates, or deletes).
The sample isn't quite complete because if there's fewer data columns than repetitions, you'd probably want to somehow lock the remaining repetitions; this part isn't done. Otherwise it works fairly well. In FM 12, however, it tends to freeze the app; I reported this to FMI, they acknowledged it, but I don't think it has been fixed already.