How to change data in the list view


Hi everyone,

I'm created a Smart Form with many List view not editable and when an item is clicked on the right it will appear the Edit Item view.

18335i39E509F53E17FAF6.png

 

The question is, how can I change the data in the List view? In the example the H3 (in yellow) is actually called "Fair condition". I managed to change into the Item view but I don't know how to "translate" in the List view. Another example is that all 1 = Yes and 0 = No but I like to show Yes and No and not 0 and 1.

Is that possible in the List View?

Thanks


12 replies

Hi,


For the first part, if you have updated it in the itemview, then it should be updated in the database therefore if you refresh the list view, it should also be updated. If it hasnt been updated in the listview then perhaps check the database and see if it has been updated. 


For the second part, i know that some controls save the value as 1 or 0 (like the checkbox), so if you arent calling it back into a checkbox control, i think it would just call the number. I doubt there is any way of displaying it as another value. You can create another coloumn in your database and save "Yes" or "No" depending on what the number is, then just have that as the display value in your listview as a workaround, but im not sure if that will work on form level (when you save/create to the database) or if you will need a stored procedure. 
Not sure if i made much sense lol, just let me know if you need clarification on anything.

Hi @Prineel_V2 


in the Item view I changed my drop-down with a "translation", example, in the database I have H1, H3 and H5 for the list of condition, but in the item view when a user will change or see the drop-down will see Fail, Fair, Good in the condition field. 



 


I like to do exactly the same in the table view...I tried but it's not working on the same way.



 



 


Is that possible?


 


P.S. I cannot change the structure of the database because come from ArchGIS.

Hi,


You can try with expression.If the column value is coming as H5 then assign Good as value.


If condition in Expression.


I think this would help.

I tried the expression and it replace all with the same data 😞

Hi,


Your list view will only show the value stored in the database (H1, H3 and H5). Can you not rename or edit those values to the display names? Or does the database you use not allow for save/update methods?. Perhaps it's possible to change those values in the database itself? 

I cannot change the database, so, the H1 must remain H1, what I like to do it's just "presented" the data with different names. Sometimes I have 0 that is No and 1 that is Yes, so i like to show Yes but I cannot change the information in the database to be Yes instead to 1.


The database come from GIS I cannot change it or it will not work ArchGIS.


The database allows update but the format must remain the same.

Im not sure if its possible to change it in the listview. From my understanding of K2, this is not possible at all, maybe someone has a solution or work-around. Hopefully there is one.


 


Kind Regards


Prineel

Hello @squaladesign 


 


I am going to show you how I solved this issue using MS SQL as my database and K2. You should be able to adapt some parts to your solution.


 


With any database you have relations (Primary keys and Foreign Keys), so you will have to stipulate that in K2 as to how the DB is linked to one another. In order to do that you will use Associations.


 


Let me show you how I achieved with an example:


 


1. The following is my Database Diagram


 



As you can see, the condition table contains the following values:


 



And Pole Inspection contains the following values:



The reason for the ConditionID (int) in the above table is because it links the type of condition. In your case it is the H1, H2.... These values are the primary keys and wouldn't change, so you just would have to update the records in the Data.Conditions table and it will change the values in all tables.


 


2. When you create your smart objects, you will need to do the following:


 


Firstly you will need to add an association (it basically means which table is connected to which and by what values are they  linked)


 



 


Add your association


 



 


Next, indicate which values are linked to one another


 



 


Next, when designing your view, configure it as below:


 



The above image indicates that the values in the condition row are linked to another smartobject by a specific ID (ConditionID) and we want to display the certain field (ConditionType) instead of the ID. 


 


Finally when you run your Form, it will link the ID property to the Condition Type and Displays as follows:


 



I hope this helps you and if it did, please mark as complete.


 


Kind Regards


 

Hi,


I have one smo having id and level


id    level


1      Low 1


2      Med 1


3      High 1


now i created list view using this smo and on value field I have added expression. So whenever in your list view column has value Low 1 it will disply as Low and all other values as Medium.



 



Remember when we use column from smo ,the field in body section of column contains the db field. If we use same column in expression ,it will give round error. So remove that and add expression.


Below is the output. 



Try by this way..Hope to be helpful


 

Badge +8

* There is a way to do it without updating the main table.


 


1. From your listview, add a column/field in which you don't use but included in your SMO.


    or you can use the existing column/field.


   - this column is for your H1 - Fair / H2 - Good / H3 - Excellent.


2. Create an expression (expressCondition)


   (if SMO.condtion='H1', Fair, else (if SMO.condition='H2', Good, Excellent))


3. from you listview loading or initialize


   add the following commands


  - for all rows


     then edit the selected row on the editable list


     then transfer data (use the expressCondition in step 2 to set the field you define in step 1)


     then apply the changes made to the row on the editable list


Click Ok


 


It should work. I used the same functions on all my listview with the same requirements.


we call it runtime append.


 


Hope it will help you.


 


Regards;


 

Thank @VasanNaick It will be a good solution if I have to change only 1 column, but I have at least 7 columns per each table and i have around 20 tables 😞
I was looking on a quick solution.
Thanks @Dabuskol I tried that solution before open the question and it didn't work, I will try again.
Thanks

Reply