cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ramole
Post Prodigy
Post Prodigy

Radio Button selected

Hi 

I need help please I have a SharePoint List Called Transactions, what I want is whenever i click the Radio button a Credit to reduce the balance column the TransAmount and submit and if I click Debit to add up the balance TransAmount i type on Transaction Amount field and submit, i dont know if i need patch or form submit. 

 

 

 

 

 

Transactions Form 

 

Captjjure.PNG

Transactions List


Capturebf.PNG

 

 

Thank you

 

 

 

 

 

 

Thank you
1 ACCEPTED SOLUTION

Accepted Solutions

@Ramole ,

I understand exactly what you need - I have also now tested the code and used a slightly different version to specify the record. I am assuming you have selected the record from a gallery - you will have to fill in your field and control names

With(
   {
      varAmount: 
      If(
         YourRadioControl.Selected.Value = "Credit",
         Value(YourTextBox.Text),
         -Value(YourTextBox.Text)
      ),
      wRecord: YourGalleryName.Selected
   },
   Patch(
      YourListName,
      {ID: wRecord.ID},
      {YourNumberField: wRecord.YourNumberField + varAmount}
   )
)

If this does not work for you, can you please post the code you used (in Text).

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

36 REPLIES 36
WarrenBelz
Super User III
Super User III

@Ramole ,

You would use a Patch with something like this

With(
   {
      varAmount:
      If(
         YourRadioName.Selected.Value = "Credit",
         Value(YourAmountControlName.Text),
         -Value(YourAmountControlName.Text)
      )
   },
   Patch(
      YourListName,      
      <Your Patch criteria here>,
      {Balance:Balance+varAmount}
   )
)

I assume you can fill in the rest - you have been posting here for a long time.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

@WarrenBelz 

 

Thank you master, but i could not workout this can you please help complete formula, i know i have been posting for a while but now i am trying hard to learn and document so i will be PowerApps master like you some day 😥

 

@WarrenBelz  I really appreciate your help and I have learned a lot from you thanks a lot

 

 

 

 

Thank you

@Ramole ,

My comment was more around that I can only respond to the details you provide. You will have to give me all your field, control and table names that are relevant and also a bit more information on what exactly you are trying to do (what are you saving and how). You could also use the same logic I posted (in the top With() statement) to adjust the field and then use SubmitForm(), although Patching is probably less complex.

Can you please take a few moments to read my blog on forum posting .

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

 

 

 

@WarrenBelz 

 

I think I have posted my list names on the screenshot , okay all I need is when I click the radio control the Credit  to increase the balance of the customer otherwise decrease on click debit and submit




Thanks 

Thank you

@Ramole ,

Please have a go at the Patch code and I can correct any issues you have.

I am happy to help you, but I asked for (and need) a lot more than the field names which are in your post.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz 

 

1- @WarrenBelz  I have tried your formula its just doubling the balance no matter what I click Credit or Debit 

 

2- My need is I have a list called transactions in SharePoint so I need whenever I create a record I have a requirements field TransType which is a radio button and I ask if its Credit or Debit.
Here what I need when I click one of those on Credit reduce the balance and if its more than the balance recorded
or else if I click Debit increase the balance 

 

 

Thanks 

 

 

 

 

 

 

 

 

Thank you

@Ramole ,

I understand exactly what you need - I have also now tested the code and used a slightly different version to specify the record. I am assuming you have selected the record from a gallery - you will have to fill in your field and control names

With(
   {
      varAmount: 
      If(
         YourRadioControl.Selected.Value = "Credit",
         Value(YourTextBox.Text),
         -Value(YourTextBox.Text)
      ),
      wRecord: YourGalleryName.Selected
   },
   Patch(
      YourListName,
      {ID: wRecord.ID},
      {YourNumberField: wRecord.YourNumberField + varAmount}
   )
)

If this does not work for you, can you please post the code you used (in Text).

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

 

With(
   {
      varAmount:
      If(
         DataCardValue32.Selected.Value = "Credit",
         Value(DataCardValue26.Text),
         -Value(DataCardValue26.Text)
      )
   },
   Patch(
      Transactions,  
      Defaults(Transactions),    
      {
          TransNum:Last(Transactions).TransNum+1,
      CustId:varRecord.CustId,
      TransType:DataCardValue32.Selected,
      TransDate:DataCardValue25.SelectedDate,
      TransAmount: Value( DataCardValue26.Text),
      TransDesc:DataCardValue28.Text,
      UpdatedUserId:User().FullName,
      TransStatus:DataCardValue34.Selected,
      TransDueDate:DataCardValue1.SelectedDate ,
      Balance:DataCardValue27.Text + varAmount
      }
   )
)

 

 

 

 

 

 

 

 

 

 

 

Thank you

@Ramole ,

I posted an update just as you did, but you are patching a new record (which is why you need to specify a bit more and include actual code when you post) - my code updated an existing record.

If DataCardValue27 is the existing balance, you need 

Balance:Value(DataCardValue27) + varAmount

I can assure you that the varAmount produces a positive or negative amount depending on the Radio setting.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors