How do I insert the data into the table with Expression?

Hi.

As I said in the issue title, I would like to insert the data which I got from the structure with Expression.


I put the form with table record which has input widgets.

But I would like to make one of them not a input widget. I mean I want to use the data in the structure(I've already implemented the SQL and succeeded it.) for inserting to the table with the fields datum which are filled by users.


Are there any way to implements above?

What widget should I use?


*I don't stick to any specific way... Any way is pretty fine to realize what I want to do.


Thanks.

Hi Yukiya Miyamoto,

If all you want is to display data that you fetched from somewhere... just drop an Expression where you would normally have your Input widget, set as its Value property the value you are trying to display (could be something like MyQuery.List.Current.MyStructure.MyAttribute).

If you already have the Input widget that allows the user to type in the value and you just want to replace it with a read-only version, do the same and just copy & paste the Input'sVariable property's value to the Expression's Value property (and then you can delete the Input widget).

Hope this helps!

Hi, Jorge Martins!

Thank you for your reply.

what I want to do is bit different.

I'll attach the image which shows current situation.

There is a form to create a new row in the table. Most of them are input widget for user input.

But I already get the staff code(the code of  the registered user) and I would like to insert  this to the table with other inputs because someone who fill out these blanks doesn't need to fill in the staff code.(already decided)


Sorry my poor explanation and Japanese in the image...



Thank you.



Jorge Martins wrote:

Hi Yukiya Miyamoto,

If all you want is to display data that you fetched from somewhere... just drop an Expression where you would normally have your Input widget, set as its Value property the value you are trying to display (could be something like MyQuery.List.Current.MyStructure.MyAttribute).

If you already have the Input widget that allows the user to type in the value and you just want to replace it with a read-only version, do the same and just copy & paste the Input'sVariable property's value to the Expression's Value property (and then you can delete the Input widget).

Hope this helps!



Since you already know the code all you need to do is assign that StaffCode to the FormRecord.StaffCode right before passing it to CreateOrUpdate action.

Hi, Vitaly Martynenko.


Thanks to your reply, I made it!

Thank you very much!


Could I ask you one more question?

I would like to let the staff code look same as the others. (like having blank and the staff code is set...)

Is it possible? Do you have any ideas? 


Thank you.

Yukiya Miyamoto wrote:

I would like to let the staff code look same as the others. (like having blank and the staff code is set...)

Is it possible? Do you have any ideas? 

So you want to have this StaffCode to look the same as other inputs, right? In this case you would want to follow Jorge's recipe - put an Input there, set it as read-only and associate it with StaffCode variable (or FormRecord.StaffCode, but it has to be set in Preparation).

On a side note, the Japanese chars look pretty cool :-) 

Solution

Hi Yukiya Miyamoto and Vitaly Martynenko,

My original suggestion was to replace the Input with an Expression, not to set the Input as read-only... but more on that below.

If your goal is to have your Staff Code look like it is in a pre-filled, read-only Input, then you can either set your Input widget's Enabled property to False (which I don't advise, as it may make your application more vulnerable to malicious users), or you can set the Expression's Style Class property to input (which is the default value of any Input's Style Class property) and adjust the remaining CSS so it is similar to the rest of your inputs.

Check the attached module for an example.

Solution

I see...

I got what you mean!

Thank you for your suggestion!

Wim van den Brink wrote:

On a side note, the Japanese chars look pretty cool :-) 


Thank you!

Happy to hear that! 

Jorge Martins wrote:

Hi Yukiya Miyamoto and Vitaly Martynenko,

My original suggestion was to replace the Input with an Expression, not to set the Input as read-only... but more on that below.

If your goal is to have your Staff Code look like it is in a pre-filled, read-only Input, then you can either set your Input widget's Enabled property to False (which I don't advise, as it may make your application more vulnerable to malicious users), or you can set the Expression's Style Class property to input (which is the default value of any Input's Style Class property) and adjust the remaining CSS so it is similar to the rest of your inputs.

Check the attaRer an example.

Thank you for your advice and Sample!

I finally got what you meant!

I'll try the way you advise.

Really thank you again.