react-admin conditional rendering on select field - react-admin

I got stuck a little bit:
I've got Field A which is for querying the projects (Select field -> ReferenceInput) when the user hits this, we should only show the user on Field B (Select Field -> ReferenceInput) the relevant tasks based on the projectId.
How could I achieve this?
Link to image to visualise the problem

What you’re looking for is the useFormState or FormDataConsumer. Take a look in the docs and let me know if you have any other questions related.
https://marmelab.com/react-admin/Inputs.html#linking-two-inputs

Related

Display parent and child node of a particular node by querying in OrientDB

I tried querying using 'select' and 'traverse' function in OrientDB. Result is shown in the browse tab but I want it to get reflected on the graph as well. I want that part of the graph to be highlighted or something. Is there a way to do it?
I guess the answer you are looking for is this one
select expand(both()) from user where username = 'mitchken'
This will provide my own user and all edges starting from me going in or out.

Where in the Sitefinity database is content stored?

I've successfully migrated 1,000s of news items and other content from Sitefinity 5 to Wordpress after hours of excruciating analysis and sheer luck with guessing but have a few items that are still left over. Specifically the pages. I know a lot of the content is stored in very obscure ways but there has to be somebody who has done this before and can steer me in the right direction.
My research (and text-search against the DB) has found the page titles etc but when I search the content I get nothing. My gut tells me that the content is being stored in binary form, can anyone confirm if this is the case?
Sitefinity documentation is only helpful if you're a .net developer who has a site set up in Visual Studio (as far as I've seen).
This is probably the most obfuscated manner of storing content that I've ever encountered. After performing text searches against the database I've finally found where the content is stored but it's not a simple process to get it out.
Pages' master record appears to be sf_page_node, there are related tables:
sf_object_data (page_id is related to sf_page_node.content_id)
sf_draft_pages (page_id is related to sf_page_node.content_id)
sf_page_data (content_id is related to sf_page_node.content_id)
sf_control_properties (control_id is related to sf_object_data.id)
So you could get the info you need with a query like this:
select * from
[sf_page_node]
join sf_object_data on sf_page_node.content_id = sf_object_data.page_id
join sf_control_properties on sf_object_data.id = sf_control_properties.control_id
Other things to consider:
the parent_id field is related to the sf_page_node table, so if you're writing a script, be sure to query this as well
the page may have a banner image, you will pick up the "place_holder" value as 'BannerHolder' with a caption of "Image" The image may be stored as blobs in sf_media_content, you should handle this separately. The "nme" value of 'ImageId' will have a GUID in the "val" column. You can query sf_media_content with this value as "content_id" the actual binary data is stored in sf_chunks, they relate on "file_id"
My revised query taking into account what I'll need to migrate content is below:
select
original.content_id,
original.url_name_,
original.title_,
parent.id,
parent.url_name_,
parent.title_,
place_holder,
sf_object_data.caption_,
sf_control_properties.nme,
val
from [sf_page_node] original
join sf_object_data on original.content_id = sf_object_data.page_id
join sf_control_properties on sf_object_data.id = sf_control_properties.control_id
join sf_page_node parent on original.parent_id = parent.id
I hope this helps someone!
You don't need the version items in this case - as you already found out, it stores the previous version of the pages in binary format.
The current live pages' data is available in sf_control_properties and sf_object_data tables. You need to join these together with sf_page_data and sf_page_node and you will get the full picture.
Depending on your requirements, it may be easier to do a GET request to each page and parse the returned html response.

Can a table field be founded and then updated with a value in mvc Controller

yeah so the question is pretty simple: Can a table field be found using and ID and then updated with a value in mvc Controller?
And before anyone gets downvote crazy... I have no example because I don't know how to do this... it's not a home work question or any other things that you down vote on this site. It's a simple question that I need an answer and a example.
I now you can use the .find to and pass the ID... to a dataset but there is nothing I can find that shows you how to edit the values in the table once you find it.
So this part I get, This will allow me to find the the id with in the dataset.
TEST_DS tEST_DS = db.TEST_DS.Find(id);
if (tEST_DS == null)
{
return HttpNotFound();
}
Also I know that you see a call to the database like This
db.TEST_TABLE.Add(TEST_DS);
I don't see an option for edit or anything like that.
The task is to update a table field, The field is a status field so when the user makes a change on the mvc create form. When they create a record I want to mark a different table's status field with a number that represents a record was created.
Did a search did not see anything.. thanks may be something mvc can't do because of it's limitations or something.
If you do answer question I will need an example of a link to an example on how to do it. Thanks!!
I was able to make this work some I will post It there for others as they might have the same issues when dealing that mvc limitations and such.
So the answer is to simply have your data table in the dbcontext that you need to edit...
The code would not post.. it asking for 4 spaces and I gave it 4 spaces and it did not work so I added a picture.
See CodeAnswer Image

Oracle Application Express SQL Query to show meaningful information

I am trying to write a query that 1) works and 2) shows meaningful information.
However, I can't seem to complete both scenarios. Both bits of code do work to a degree. My SQL query does work by showing all the useful information a user wants but when you click the edit button it doesn't link properly so it won't allow the user to update that row. The other shows only keys and rowid but when you click edit does show the information and allows it to be updated.
So as not to get another down-voted question, I have taken pictures of each scenario to show the problem, but, ultimately, I need to show meaningful information: an id or key isn't meaningful to the vast majority of users.
Here is my code
SELECT APPLICATIONS.APP_ID, APPLICATIONS.SRN, STUDENTS.SURNAME, STUDENTS.FORENAME, APP_STATUS.STATUS, METHODS.METHOD, JOBS.JOB_TITLE, APPLICATIONS.APP_DATE
FROM APPLICATIONS
JOIN STUDENTS
ON APPLICATIONS.SRN = STUDENTS.SRN
JOIN APP_STATUS
ON APPLICATIONS.STATUS_ID = APP_STATUS.STATUS_ID
JOIN METHODS
ON APPLICATIONS.METHOD_ID = METHODS.METHOD_ID
JOIN JOBS
ON APPLICATIONS.JOB_ID = JOBS.JOB_ID;
and here are the pictures of it in action
below is the code that does not show meaningful information but does work.
select "ROWID",
"APP_ID",
"SRN",
"STATUS_ID",
"METHOD_ID",
"JOB_ID",
"APP_DATE"
from "#OWNER#"."APPLICATIONS"
If i knew how to properly use rowid i am sure this is a simple feat but i dont so if i could get any help it would be useful
//edit
who ever renamed this to Application Expression why? what i am using is Apex Application Express it was relevant information that got changed to something wrong which might make it hard for someone with a similar problem to find later.
In the second, simple query, apex can determine which table (and record) you are trying to edit.
In the first query, with the joins, it can't tell which of the five tables in query you want to edit. You probably want to have the edit link pass the primary key of the row from APPLICATIONS to the child page. You would need to build into that page any logic (lists of values etc) that map lookup tables (such as status) to the values needed in the APPLICATIONS table.

Few questions about Grails' createCriteria

I read about createCriteria, and kind of interested on how these works, and its usability in providing values for dropdown box.
So say, i have a table in the database, Resource table, where i have defined the table in the domain class called Resource.groovy. Resource table has a total of 10 columns, where 5 of it are
Material Id
Material description
Resource
Resource Id
Product Code
So using the createCriteria, and i can use just like a query to return the items that i want to
def resList = Resource.createCriteria().list {
and {
eq('resource', resourceInstance)
ne('materialId', '-')
}
}
Where in the above, i want to get the data that matches the resource = resourceInstance, and none of the materialId is equal to '-'.
I want to use the returned data from createCriteria above on my form, where i want to use some of the column on my select dropdown. Below is the code i used for my select dropdown.
<g:select id="resourceId" name="resourceId"
from="${resList}"
disabled="${actionName != 'show' ? false : true}" />
How do i make it so that in a dropdown, it only shows the values taken from column Product Code? I believe the list created using createCriteria returns all 10 columns based on the createCriteria's specification. But i only want to use the Product Column values on my dropdown.
How do i customize the data if in one of the select dropdown in my form, i wanted to show the values as "Resource Id - Resource Description"? The values are combination of more than 1 columns for one select dropdown but i don't know how to combine both in a single select dropdown.
I read that hql and GORM query are better ways of fetching data from table than using createCriteria. Is this true?
Thanks
First of all refer to the document for using select in Grails. To answer all questions:
Yes, the list to select from in the dropdown can be customized. In this case it should be something like from="${resList*.productCode}"
Yes, this can be customized as well with something like
from="${resList.collect { \"${it.resourceId} - ${it.resourceDesc}\" } }"
It depends. If there are associations involved in a domain then using Criteria will lead to eager fetches which might not be required. But with HQL one gets the flexibility of tailoring the query as needed. With latest version of Grails those boundries are minimized a lot. Usage of DetachedCriteria, where queries etc are recommended whereever possible. So it is kind of mixing and matching to the scenario under consideration.