How to search if a value exists in table - pega

I am trying to delete records via GUI. I have a text input in my section mapped with property (.EID) which intakes employee ID (for example 1) and when i click a button 'delete' that particular record should be deleted from DB. I have written an activity that successfully deletes.
But I want to display a message if the entered employee ID is not present in the table. For example if I have already deleted record 1 and the user again tries to delete record 1 it should display a message saying "employee doesn't exist, please enter existing ID". I have used obj-open->obj-delete->commit to delete the records.
Please help me how to achieve this.
I have attached screenshot of my GUI, for example i have already deleted record no 2, so when user again enters 2 and clicks on delete button it should display a message saying "no such user".

You can launch a local action(flow action) on the delete button.
In the pre-processing of the flow action call one activity. Pass the employee id as parameter to the activity.
In the activity do obj-browse on the table and add filter on employeeid column.
Store the count of obj-browse in a property. If the count of the obj-browse is greater than 0 then delete the record.
The section of flow action will display 2 messages based on when condition. One message will become active when count is greater than zero which will display Account deleted and another message will get active when count is zero which will display account does not exist.

Related

Firebase prevent Parent Deletion [duplicate]

I have a Firebase project with 2 mobile apps:
FriendlyChat example from Firebase/Google (messages) - created first
Grocery Items list (grocery-items) - trying to create second
You can see the messages node already there with some test messages inside.
But when I try to add a child to the appId node, I give it a name "grocery-items" and I click on ADD, but the node does not get added. It just disappears.
Why can't I add the grocery-items node?
The Firebase Database is a key-value store. It stores the values of keys at paths in the tree. But it only stores keys when they have an actual value. If there is no value for a key/path, it is immediately deleted.
So if you click the + button, then enter a key and click the Add button, it will delete the first key that you entered because it doesn't have a value.
What you instead should do depends on what you want to accomplish.
To add a single key/value pair:
click the +
enter a key/Name
enter a Value
click Add
If you want to add a JSON snippet/tree:
click the +
enter a key/Name
click the + next to the (empty) Value
enter a key/Name for the child
enter a Value for the child
click Add

show different label and values for columns in cognos report studio

I have a column "full name" in a list and I want to configure drill down for it so that when I click on a particular user's full name, it displays all the bio data of that user from another table.
My requirement is that at the front end, it should show the full names of the users, but when I click on the user's name, it should pass E-mail address of the user for the drill down.
Please need help for doing it.
I'm going to assume you are using a list object. the instructions for a crosstab would be slightly different:
Add the item you want to pass to the drill-through target to your query
In the report page, select the list
Click on the ellipses (...) in the 'Properties' property of the list object
Check the box next to the data item that you added to the query in step 1 and click 'OK'
When you define the drill-through parameters, select 'Pass the data item value' for the method and the data item added to the query in step 1 as the Value.

MS CRM 2013 Process Update Account - multiple values to one field

I'm trying to implement an update procedure like the one in this blog post (via extra entity and workflow updating account, triggered when the new entity is being created)
http://www.powerobjects.com/2013/08/01/updating-records-in-microsoft-dynamics-crm/
In my list and the new entity "Account Update" I have 3 fields for the full name of a company (name, name_2, name_3).
In my workflow I want to put these 3 together and combine their values in the Account field "Company" (the company's name).
In the process I tried to insert them via the "Form Assistant" and in the field "Company" I now have the following entry:
{Name(Account Update);Name_2(Account Update);Name_3(Account Update)}
but it doesn't seem to work. After my import and update of the account (which ends successful) the value in "Company" is only the value of the first name field.
Is it possible to combine values?
What exactly does it do, when I choose more than one field in the Form Assistant and say OK?
So at last I figured out how to archive it.
With the "Form Assistant" you can combine or add multiple field values to one new field but it is a bit tricky.
The value in the process update the properies have to look like this:
{Name(Account Update)} {Name_2(Account Update)} {Name_3(Account Update)}
BUT
It does not work if you enter this as text, you have to add the fields one after another so that they are recognized as fields (and marked yellow).
Click into the field (here: "Company").
Then choose the first field in the Form Assistant. Click "Add", choose it in the list below and click "OK". Now the field is in the field "Company".
Now go behind the end of the text in the field make a space and then choose and add the second field (clear the list in the Form Assistant before so that now only the second field is in the list)
So it's right if it looks like:
{Name(Account Update)} {Name_2(Account Update)}
Wrong if looks like following (happens when you keep the first field in the list before adding the second with "OK")
{Name(Account Update);Name_2(Account Update)}

SQL Server : sum of 2 columns in each row display

I am using SQL Server. I have 2 columns Passed students and Failed Students in my database.
How to write a query which displays both these columns along with a third column which is Total Students which displays the sum of the entries in the row?
EDIT
It is not allowing me to ask another question.So,posting it here:
I have a hyperlink field in my gridview as below:
[Please refer comment for the code.For some reason it doesn't get posted here.]
Its basically a runId.When I click on this hyperlink I am redirected to a page called RunAnalysis.I want to access the value of the runId which was clicked in this page.
I was thinking of using query string but there is no event as far as I know that is fired on click of the hyperlink.
My question is how do I access the runId value in this page ? Can someone tell me if some event is fired so that I can send a query string.
Thanks.
You haven't given a lot of background information so I am assuming many things in my response.
Here is a simple aggregated result set:
SELECT SUM(Passed) AS [Passed],SUM(Failed) AS [Failed],COUNT(*) AS [TotalStudents]
FROM dbo.Students
Now if there is some grouping you want to do then you would add a GROUP BY clause like so...
I'm creating a new column because I don't know your schema:
SELECT GradeLevel, SUM(Passed) AS [Passed],SUM(Failed) AS [Failed],COUNT(*) AS [TotalStudents]
FROM dbo.Students
GROUP BY GradeLevel
ORDER BY GradeLevel

Please read scenario below and help me to solve it

I have asp.net web page which populates grid view. One of column is Status which can have (Scheduled, InProgress, Failed, OnHold, Completed) these values and another column with link in each row to edit that particular entry. Editing is only allowed for statuses Failed, OnHold, Completed not for Scheduled, InProgress on click of entry which has status Scheduled or InProgress a pop up appears saying you cannot edit.
Now, click on link and start editing data, at same time another person with same access as mine also tries to edit same data(i.e. clicks on same link) and makes Status to Scheduled and clicks submit. The data is saved in database. Before I complete editing.
Now status for that entry is Scheduled and according to requirement it cannot be edited, but I'm able to edit data and save it database.
It should not happen. How to achieve this please help.
Thanks in advance
On the function or RowUpdating Event of the grid, you should run a SQL statement checking if the status of the row currently being updated is valid for saving (per your requirements).
If it's not, then display an error that it's been updated by someone else to a status different from the one fetched by the 2nd user trying to update it.
You can make a Column in your database like "IsEdited" and whenever a record is being inserted first run a query to retrieve the value of "IsEdited" then use If-Else statement to check. If its value is True then don't run the Insert query and display error message and if its value is False then run the Insert query with data for all other columns and also a value (True) for "IsEdited" column.
If you could provide a code it would be easy to explain.

Resources